Code of Civil Procedure CCP § 1987.2
(a) Except as specified in subdivision (c), in making an order pursuant to motion made under subdivision (c) of Section 1987 or under Section 1987.1 , the court may in its discretion award the amount of the reasonable expenses incurred in making or opposing the motion, including reasonable attorney’s fees, if the court finds the motion was made or opposed in bad faith or without substantial justification or that one or more of the requirements of the subpoena was oppressive.
(b)(1) Notwithstanding subdivision (a), absent exceptional circumstances, the court shall not impose sanctions on a subpoenaed person or the attorney of a subpoenaed person for failure to provide electronically stored information that has been lost, damaged, altered, or overwritten as the result of the routine, good faith operation of an electronic information system.
(2) This subdivision shall not be construed to alter any obligation to preserve discoverable information.
(c) If a motion is filed under Section 1987.1 for an order to quash or modify a subpoena from a court of this state for personally identifying information, as defined in subdivision (b) of Section 1798.79.8 of the Civil Code , for use in an action pending in another state, territory, or district of the United States, or in a foreign nation, and that subpoena has been served on any Internet service provider, or on the provider of any other interactive computer service, as defined in Section 230(f)(2) of Title 47 of the United States Code , if the moving party prevails, and if the underlying action arises from the moving party’s exercise of free speech rights on the Internet and the respondent has failed to make a prima facie showing of a cause of action, the court shall award the amount of the reasonable expenses incurred in making the motion, including reasonable attorney’s fees.