§ 100. Who may be exempted, and by what court. An insolvent debtor may be exempted from arrest, or discharged from imprisonment, as prescribed in this article. For that purpose, he must apply, by petition, to the county court of the county in which he resides, or is imprisoned; or, if he resides or is imprisoned in the city of New York, to the supreme court. A person, who has been admitted to the jail liberties, is deemed to be imprisoned, within the meaning of this article.