Cal. Civ. Proc. Code § 1174.27
(a) This section shall apply to an unlawful detainer proceeding in which all of the following are true:
(e) If the court determines that there is documentation evidencing abuse or violence against the tenant, the tenant’s immediate family member, or the tenant’s household member, and the court does not find the defendant raising the affirmative defense guilty of an unlawful detainer on any other grounds, then both of the following:
(f)
(1) If the court makes the determination described in subdivision (e), upon a showing that any other defendant was the perpetrator of the abuse or violence on which the affirmative defense was based and is guilty of an unlawful detainer, the court shall do both of the following:
(3) If the court makes the determination described in subdivision (e), the court may, upon a showing that any other defendant was the perpetrator of the abuse or violence on which the affirmative defense was based and is guilty of an unlawful detainer, do any of the following: