A person desirous of perpetuating the testimony of witnesses as to a a matter, whether a suit be pending in relation thereto or not, may file with a commissioner in chancery of a court wherein, if there were a bill to perpetuate the testimony, such bill might be filed, a petition stating such matter, and what persons may be affected by the testimony. Whereupon the commissioner shall appoint for proceeding on the petition a time and place, whereof reasonable notice shall be given to the persons who may be so affected. If any of them be an infant or insane person, the commissioner shall appoint a guardian ad litem who shall attend on his behalf and who shall be a practicing attorney in this state. At such time and place the commissioner shall take in writing the evidence of any witness adduced in respect to said matter by the petitioner or by the person so affected. He may adjourn from time to time, and shall return a report of his proceedings, with the testimony taken by him to the clerk's office of the court by which he was appointed, and such testimony shall have the same effect as if it had been taken on a bill to perpetuate testimony. Such court may make such order as to the costs as may seem to it right.