When:
the court 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. Such a certificate may be issued upon application of either the state or a defendant demonstrating all facts specified in subdivision (1). Upon issuing such a 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.
IC 35-37-5-7