It shall be unlawful for any person to assume or attempt to assume the duties of any office for which a bond is required, without having given the bond required. Any person assuming or attempting to assume the duties of any office as aforesaid shall be guilty of a misdemeanor and shall be subject to a fine of five hundred dollars or imprisonment for not less than three months, in the discretion of the court.