witness in criminal action in the state.
1. When (a) a criminal action is pending in a court of record of this state by reason of the filing therewith of an accusatory instrument, or a grand jury proceeding has been commenced, and (b) there is reasonable cause to believe that a person confined in a federal prison or other federal custody, either within or outside this state, possesses information material to such criminal action or proceeding, and (c) the attendance of such person as a witness in such action or proceeding is desired by a party thereto, a superior court, at a term held in the county in which such action or proceeding is pending, may issue a certificate, known as a writ of habeas corpus ad testificandum, addressed to the attorney general of the United States, certifying all such facts and requesting the attorney general of the United States to cause the attendance of such person as a witness in such court for a specified number of days under custody of a federal public servant.
2. Such a certificate may be issued upon application of either the people or a defendant, demonstrating all the facts specified in subdivision one.
3. Upon issuing such certificate, the court may deliver it, or cause or authorize it to be delivered, to the attorney general of the United States or to his representative authorized to entertain the request.