In any civil or criminal action or proceeding for violation of the so-called Cartwright Act (Chapter 2 (commencing with Section 16700) of Part 2 of Division 7 of the Business and Professions Code), the Unfair Practices Act (Chapter 4 (commencing with Section 17000) of Part 2 of Division 7 of the Business and Professions Code), or any rule of statutory or common law against monopolies or combinations in restraint of trade, proof that the act complained of was done in compliance with this chapter, or a rule or regulation of the commission issued pursuant thereto, and in furtherance of purposes and provisions thereof, shall be a complete defense to the action or proceeding.