-357§ 1638. Detention under special circumstances (a) Pending his removal to a hospital, a patient taken into custody pursuant to section 1633 or 1637 of this title, or ordered to be hospitalized pursuant to section 1637 of this title, may be detained in a medical facility, his home, or any other suitable facility under such reasonable conditions as the health director may fix, but he may not, except because of and during an extreme emergency, be detained in a nonmedical facility used for the detention of individuals charged with or convicted of penal oflfenses. The health director shall take such reasonable measures, including provision for medical care, as may be necessary to assure proper care of an individual temporarily detained pursuant to this section. (b) Notwithstanding any other provision of this chapter, a patient may not be released or discharged from custody during the pendency of proceedings for judicial hospitalization if, in the opinion of the head of the hospital, it would be unsafe to the patient or others, unless the court, upon the application of the patient or of an interested party, determines justifiable reason exists for release or discharge. § 1639. Habeas corpus An individual detained pursuant to this chapter is entitled to the writ of habeas corpus upon proper petition by himself or an interested party to any court in the Canal Zone generally empowered to issue the writ of habeas corpus. § 1640. Transportation When an individual is about to be hospitalized under the provisions of this chapter, the Health Bureau shall, upon the request of a person having a proper interest in the individual's hospitalization, arrange for the individual's transportation to the hospital with suitable medical or nursing attendants and by such means as may be suitable for his medical condition. Wlien practicable, the individual to be hospitalized shall be permitted to be accompanied by one or more of his friends or relatives. § 1641. Notice of hospitalization or discharge (a) When a patient has been admitted to a hospital pursuant to this chapter other than upon his own application, the head of the hospital shall notify immediately the patient's legal guardian, parent or parents, spouse, or next of kin, if known. (b) The head of the hospital admitting an individual under any provision of this chapter, or discharging an individual so admitted, shall forthwith make a report thereof to the health director, and, if the patient was hospitalized under section 1637 of this title, to the district court. § 1642. Right to humane care and treatment The Health Bureau shall be guided by the principles of humane care and treatment, and, to the extent that facilities, equipment and personnel are available, shall provide medical care or treatment in accordance with the highest standards of accepted medical practice. § 1643. Mechanical restraints Mechanical restraints may not be applied to a patient unless determined by the head of the hospital to be required by the medical needs of the patient. Every use of a mechanical restraint and reasons therefor shall be made a part of the clinical record of the patient over the signature of the head of the hospital.