A licensing officer who knowingly issues a marriage license knowing it to be in violation of the provisions of this chapter or who wilfully and wrongfully refuses to issue a license is guilty of a misdemeanor, and upon conviction is punishable by imprisonment for not more than six months, or by a fine of not more than $500, or by both.