(a) General rule.--Any judge of a court of record may issue the writ of habeas corpus to inquire into the cause of detention of any person or for any other lawful purpose.
(b) Venue.--The venue of matters brought under this chapter shall be as prescribed by general rule.