A judge of a state court of record in another state, which by its laws has made provision for commanding persons confined in penal institutions within that state to attend and testify in this state, may certify (1) that there is a criminal proceeding or investigation by a grand jury or a criminal action pending in the court, (2) that a person who is confined in a penal institution in this state may be a material witness in the proceeding, investigation, or action, and (3) that his presence will be required during a specified time. Upon presentation of the certificate to any judge having jurisdiction over the person confined, and upon notice to the attorney general, the judge in this state shall fix a time and place for a hearing and shall make an order directed to the person having custody of the prisoner requiring that the prisoner be produced before him at the hearing.
If at the hearing the judge determines (1) that the witness may be material and necessary, (2) that his attending and testifying are not adverse to the interests of this state or to the health or legal rights of the witness, (3) that the laws of the state in which he is requested to testify will give him protection from arrest and the service of civil and criminal process because of any act committed prior to his arrival in the state under the order, and (4) that as a practical matter the possibility is negligible that the witness may be subject to arrest or to the service of civil or criminal process in any state through which he will be required to pass, the judge shall issue an order, with a copy of the certificate attached, (a) directing the witness to attend and testify, (b) directing the person having custody of the witness to produce him, in the court where the criminal action is pending, or where the grand jury investigation is pending, at a time and place specified in the order, and (c) prescribing such conditions as the judge shall determine.
K.S.A. 22-4208