In any action on a contract or lease entered into after September 21, 1977, where such contract or lease specifically provides that attorneys' fees and costs, which are incurred to enforce the provisions of such contract or lease, shall be awarded to one of the parties, the prevailing party, whether he or she is the party specified in the contract or lease or not, shall be entitled to reasonable attorneys' fees in addition to costs and necessary disbursements.
Attorneys' fees provided for by this section shall not be subject to waiver by the parties to any contract or lease which is entered into after September 21, 1977. Any provision in any such contract or lease which provides for a waiver of attorneys' fees is void.
As used in this section "prevailing party" means the party in whose favor final judgment is rendered.