(a) Except as otherwise provided by law or where waived by the parties to an agreement, in any action on a contract based on a book account, as defined in Section 337a of the Code of Civil Procedure, entered into on or after January 1, 1987, which does not provide for attorney's fees and costs, as provided in Section 1717, the party who is determined to be the party prevailing on the contract shall be entitled to reasonable attorney's fees, as provided below, in addition to other costs. The prevailing