Municipal employees; gift or receipt of compensation from other than municipality; acting as agent or attorney.

Section 17. (a) No municipal employee shall, otherwise than as provided by law for the proper discharge of official duties, directly or indirectly receive or request compensation from anyone other than the city or town or municipal agency in relation to any particular matter in which the same city or town is a party or has a direct and substantial interest.

(b) No person shall knowingly, otherwise than as provided by law for the proper discharge of official duties, directly or indirectly give, promise or offer such compensation.

(c) No municipal employee shall, otherwise than in the proper discharge of his official duties, act as agent or attorney for anyone other than the city or town or municipal agency in prosecuting any claim against the same city or town, or as agent or attorney for anyone in connection with any particular matter in which the same city or town is a party or has a direct and substantial interest.

Whoever violates any provision of this section shall be punished by a fine of not more than $10,000, or by imprisonment in the state prison for not more than 5 years, or in a jail or house of correction for not more than 2 ½ years, or both.

A special municipal employee shall be subject to paragraphs (a) and (c) only in relation to a particular matter (a) in which he has at any time participated as a municipal employee, or (b) which is or within one year has been a subject of his official responsibility, or (c) which is pending in the municipal agency in which he is serving. Clause (c) of the preceding sentence shall not apply in the case of a special municipal employee who serves on no more than sixty days during any period of three hundred and sixty-five consecutive days.

This section shall not prevent a municipal employee from taking uncompensated action, not inconsistent with the faithful performance of his duties, to aid or assist any person who is the subject of disciplinary or other personnel administration proceedings with respect to those proceedings.

This section shall not prevent a municipal employee, including a special employee, from acting, with or without compensation, as agent or attorney for or otherwise aiding or assisting members of his immediate family or any person for whom he is serving as guardian, executor, administrator, trustee or other personal fiduciary except in those matters in which he has participated or which are the subject of his official responsibility; provided, that the official responsible for appointment to his position approves.

This section shall not prevent a present or former special municipal employee from aiding or assisting another person for compensation in the performance of work under a contract with or for the benefit of the city or town; provided, that the head of the special municipal employee's department or agency has certified in writing that the interest of the city or town requires such aid or assistance and the certification has been filed with the clerk of the city or town. The certification shall be open to public inspection.

This section shall not prevent a municipal employee from giving testimony under oath or making statements required to be made under penalty for perjury or contempt.

This section shall not prevent a municipal employee from applying on behalf of anyone for a building, electrical, wiring, plumbing, gas fitting or septic system permit, nor from receiving compensation in relation to any such permit, unless such employee is employed by or provides services to the permit-granting agency or an agency that regulates the activities of the permit-granting agency.