Any elector who shall wilfully vote at any primary the ballot of a party in which he is not enrolled, in violation of the provisions of this act, shall be guilty of a misdemeanor of the second degree, and, upon conviction thereof, shall be sentenced to pay a fine not exceeding five thousand ($5,000) dollars, or to undergo an imprisonment of not more than two (2) years, or both, in the discretion of the court.
25 P.S.§ 3534