CAL. CCP. CODE § 128 : California Code - Section 128

(a) Every court shall have the power to do all of the following:

(1) To preserve and enforce order in its immediate presence.

(2) To enforce order in the proceedings before it, or before a person or persons empowered to conduct a judicial investigation under its authority.

(3) To provide for the orderly conduct of proceedings before it, or its officers.

(4) To compel obedience to its judgments, orders, and process, and to the orders of a judge out of court, in an action or proceeding pending therein.

(5) To control in furtherance of justice, the conduct of its ministerial officers, and of all other persons in any manner connected with a judicial proceeding before it, in every matter pertaining thereto.

(6) To compel the attendance of persons to testify in an action or proceeding pending therein, in the cases and manner provided in this code.

(7) To administer oaths in an action or proceeding pending therein, and in all other cases where it may be necessary in the exercise of its powers and duties.

(8) To amend and control its process and orders so as to make them conform to law and justice. An appellate court shall not reverse or vacate a duly entered judgment upon an agreement or stipulation of the parties unless the court finds both of the following:

(A) There is no reasonable possibility that the interests of nonparties or the public will be adversely affected by the reversal.

(B) The reasons of the parties for requesting reversal outweigh the erosion of public trust that may result from the nullification of a judgment and the risk that the availability of stipulated reversal will reduce the incentive for pretrial settlement.

(b) Notwithstanding Section 1211 or any other law, if an order of contempt is made affecting an attorney, his or her agent, investigator, or any person acting under the attorney's direction, in the preparation and conduct of any action or proceeding, the execution of any sentence shall be stayed pending the filing within three judicial days of a petition for extraordinary relief testing the lawfulness of the court's order, the violation of which is the basis of the contempt except for the conduct as may be proscribed by subdivision (b) of Section 6068 of the Business and Professions Code, relating to an attorney's duty to maintain respect due to the courts and judicial officers.

(c) Notwithstanding Section 1211 or any other law, if an order of contempt is made affecting a public safety employee acting within the scope of employment for reason of the employee's failure to comply with a duly issued subpoena or subpoena duces tecum, the execution of any sentence shall be stayed pending the filing within three judicial days of a petition for extraordinary relief testing the lawfulness of the court's order, a violation of which is the basis for the contempt.

As used in this subdivision, "public safety employee" includes any peace officer, firefighter, paramedic, or any other employee of a public law enforcement agency whose duty is either to maintain official records or to analyze or present evidence for investigative or prosecutorial purposes.

(d) Notwithstanding Section 1211 or any other law, if an order of contempt is made affecting the victim of a sexual assault, where the contempt consists of refusing to testify concerning that sexual assault, the execution of any sentence shall be stayed pending the filing within three judicial days of a petition for extraordinary relief testing the lawfulness of the court's order, a violation of which is the basis for the contempt.

As used in this subdivision, "sexual assault" means any act made punishable by Section 261, 262, 264.1, 285, 286, 288, 288a, or 289 of the Penal Code.

(e) Notwithstanding Section 1211 or any other law, if an order of contempt is made affecting the victim of domestic violence, where the contempt consists of refusing to testify concerning that domestic violence, the execution of any sentence shall be stayed pending the filing within three judicial days of a petition for extraordinary relief testing the lawfulness of the court's order, a violation of which is the basis for the contempt.

As used in this subdivision, the term "domestic violence" means "domestic violence" as defined in Section 6211 of the Family Code.

(f) Notwithstanding Section 1211 or any other provision of law, no order of contempt shall be made affecting a county government or any member of its governing body acting pursuant to its constitutional or statutory authority unless the court finds, based on a review of evidence presented at a hearing conducted for this purpose, that either of the following conditions exist:

(1) That the county has the resources necessary to comply with the order of the court.

(2) That the county has the authority, without recourse to voter approval or without incurring additional indebtedness, to generate the additional resources necessary to comply with the order of the court, that compliance with the order of the court will not expose the county, any member of its governing body, or any other county officer to liability for failure to perform other constitutional or statutory duties, and that compliance with the order of the court will not deprive the county of resources necessary for its reasonable support and maintenance.