In any action or proceeding to enforce a provision of this chapter, the court or tribunal may allow the prevailing party, other than government, a reasonable attorney fee as part of costs; provided, however, that, in any action brought against a judicial officer for an act or omission taken in such officer’s judicial capacity, such officer shall not be held liable for any costs, including attorney’s fees, unless such action was clearly in excess of such officer’s jurisdiction.