An appeal may be taken to the court of appeal by the people from a final order of a superior court made upon the return of a writ of habeas corpus discharging a defendant or otherwise granting all or any part of the relief sought, in all criminal cases, excepting criminal cases where judgment of death has been rendered, and in such cases to the Supreme Court; and in all criminal cases where an application for a writ of habeas corpus has been heard and determined in a court of appeal, either the defendant or the people may apply for a hearing in the Supreme Court. Such appeal shall be taken and such application for hearing in the Supreme Court shall be made in accordance with rules to be laid down by the Judicial Council. If the people appeal from an order granting the discharge or release of the defendant, or petition for hearing in either the court of appeal or the Supreme Court, the defendant shall be admitted to bail or released on his own recognizance or any other conditions which the court deems just and reasonable, subject to the same limitations, terms, and conditions which are applicable to, or may be imposed upon, a defendant who is awaiting trial. If the order grants relief other than a discharge or release from custody, the trial court or the court in which the appeal or petition for hearing is pending may, upon application by the people, in its discretion, and upon such conditions as it deems just stay the execution of the order pending final determination of the matter.
Ca. Pen. Code § 1506