No court or judge shall inquire into the legality of any judgment or process, whereby the party is in custody, or discharge him when the term of commitment has not expired in either of the cases following:
First. Upon process issued by any court or judge of the United States, or where such court or judge has exclusive jurisdiction; or, Second. Upon any process issued on any final judgment of a court of competent jurisdiction; or,
Third. For any contempt of any court, officer or body having authority to commit; but an order of commitment as for a contempt, upon proceedings to enforce the remedy of a party, is not included in any of the foregoing specifications;
Fourth. Upon a warrant or commitment issued from the district court, or any other court of competent jurisdiction, upon an indictment or information.
Okla. Stat. tit. 12, § 1342