The court may receive proof by affidavits, depositions, oral testimony, or other evidence. In its discretion the court may order the petitioner brought before the court for the hearing. If the court finds in favor of the petitioner, it shall enter an appropriate order with respect to the judgment or sentence in the former proceedings and such supplementary orders as to rearraignment, retrial, custody, conditions of pretrial release or discharge as may be necessary and proper.
725 ILCS 5/122-6