(a) General rule.--Except as set forth in subsection (b), it shall be unlawful for a constable to hold or exercise the office of magisterial district judge or alderman.
(b) Exceptions.--Nothing in this section or in any other law or court rule shall be construed to prohibit a constable from:
(1) being an officer of a political body or political party as those terms are defined in the act of June 3, 1937 (P.L.1333, No.320), known as the Pennsylvania Election Code;
(2) holding the office of a national, State or county committee of a political party;
(3) running for and holding an elective office; or
(4) participating in election-day activities.