(d) 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.