2856. Waiver of guarantor's rights of subrogation and reimbursement
(a) Any guarantor, including a guarantor of an obligation secured by real property or any interest therein, may waive the guarantor's rights of subrogation and reimbursement and any other rights and defenses available to the guarantor by reason of Sections 2787 to 2855, inclusive, including, without limitation, (1) any defenses the guarantor may have to the guaranty obligation by reason of an election of remedies by the creditor and (2) any rights or defenses the guarantor may have by reason of protection afforded to the principal with respect to the obligation so guaranteed pursuant to the antideficiency or other laws of this state limiting or discharging the principal's indebtedness, including, without limitation, Section 580a, 580b, 580d, or 726 of the Code of Civil Procedure.
(b) Any language that expressly sets forth a waiver of suretyship rights or defenses described in subdivision (a), or any of them, shall be effective whether or not it contains references to statutory provisions or judicial decisions. The following language shall be an effective waiver of the guarantor's defense to a recovery by the creditor by reason of the creditor's election of remedies:
Guarantor waives all rights and defenses arising out of an election of remedies by the creditor, even though that election of remedies, such as a nonjudicial foreclosure with respect to security for a guaranteed obligation, has destroyed the guarantor's rights of subrogation and reimbursement against the principal by the operation of Section 580d of the Code of Civil Procedure or otherwise.
(c) Subdivision (b) shall not apply to a guaranty of a loan to an individual primarily for personal, family, or household purposes, secured by a deed of trust or mortgage on a dwelling for not more than four families when the dwelling is occupied, entirely or in part, by the borrower.