If, because of a declared conflict of interest, any judge, who is otherwise entitled to representation pursuant to Section 825, 995, or 27647, is required to retain his own counsel, such judge is entitled to recover from the appropriate public entity such reasonable attorney’s fees, costs, and expenses as were necessarily incurred thereby.