(a) If a judge of a court of record in any other state, which by its laws has made provision for commanding a prisoner within that state to attend and testify in this state, certifies under the seal of the court that:

(1) There is a criminal prosecution pending in that court or that a grand jury investigation has commenced;
(2) A person convicted, sentenced and confined in a state or local custodial facility, other than a person awaiting execution of a sentence of death, is a material witness in the prosecution or investigation; and
(3) The person’s presence is required for a specific number of days;

a judge of a court with jurisdiction to try felony cases in the county where the person is confined, after notice to the district attorney general, shall fix a time and place for a hearing and shall order the person having custody of the prisoner to produce the prisoner at the hearing.

(b) If, at that hearing, the judge determines that the prisoner is a material and necessary witness in the requesting state, the judge shall issue an order directing that the prisoner attend the court where the prosecution or investigation is pending, upon the terms and conditions as the judge prescribes, including:

(1) Provision for the return of the prisoner at the conclusion of the prisoner’s testimony;
(2) Proper safeguards on the prisoner’s custody; and
(3) Proper financial reimbursement or other payment by the demanding jurisdiction for all expenses incurred in the production and return of the prisoner.
(c) The district attorney general is authorized to enter into agreements with authorities of the demanding jurisdiction to ensure proper compliance with the order of the court.
(d) When a criminal action is pending in a court of record of this state by reason of the filing of an indictment or presentment or by reason of the commencement of a grand jury proceeding or investigation, if:

(1) There is reasonable cause to believe that a person convicted, sentenced and confined in a state or local custodial facility of another state, other than a person awaiting execution of a sentence of death or one confined as mentally ill, possesses information material to the criminal action;
(2) The attendance of the person as a witness in the action is desired by a party; and
(3) The state in which the person is confined possesses a statute equivalent to this section;

a judge of the court in which the action is pending may issue a certificate certifying all the facts and that the attendance of the person as a witness in the court is required for a specific number of days. The certificate may be issued upon application of either the state or defendant demonstrating all the facts specified in this section.

(e) Upon issuing a certificate, the court shall deliver it, or cause or authorize it to be delivered, to a court of the other state which, pursuant to the laws of that state, is authorized to undertake legal action for the delivery of the prisoner to this state as a witness.