The court or magistrate to whom the petition is presented shall, without delay, issue a writ of habeas corpus, substantially in the form heretofore established and used in the commonwealth, and returnable forthwith to the supreme judicial court, or a justice thereof, at such place as shall be designated in the writ.
Mass. Gen. Laws ch. 248, § 4