Section 12. (a) A former county employee who knowingly acts as agent or attorney for or receives compensation directly or indirectly from anyone other than a county or a county agency in connection with any particular matter in which the county or a county agency of the same county is a party or has a direct and substantial interest and in which he participated as a county employee while so employed, or
(b) A former county employee who, within one year after his last employment has ceased, appears personally before any agency of the county as agent or attorney for anyone other than the county in connection with any particular matter in which the county or a county agency of the same county is a party or has a direct and substantial interest and which was under his official responsibility as a county employee at any time within a period of two years prior to the termination of his employment, or
(c) A partner of a former county employee who knowingly engages, during a period of one year following the termination of the latter's employment by the county, in any activity in which the former county employee is himself prohibited from engaging by clause (a), or
(d) A partner of a county employee who knowingly acts as agent or attorney for anyone other than the county in connection with any particular matter in which the county or a county agency of the same county is a party or has a direct and substantial interest and in which the county employee participates or has participated as a county employee or which is the subject of his official responsibility, 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 1/2 years, or both.
If a partner of a special county employee or of a former county employee is also a member of another partnership in which the special or former employee has no interest, activities of the latter partnership in which the special or former employee takes no part shall not thereby be subject to clause (c) or (d).
This section shall not prevent a present or former special county employee from aiding or assisting another person for compensation in the performance of work under a contract with or for the benefit of the county; provided, that the head of the special county employee's department or agency has certified in writing that the interest of the county requires such aid or assistance and the certification has been filed with the state ethics commission. The certification shall be open to public inspection.