If an action is brought for the recovery of any assessment prior to the time permitted for bringing such action, the plaintiff shall not recover and the defendant shall be entitled to have and recover such attorney’s fees as the court may deem reasonable in addition to all taxable costs and he may have judgment therefor.