Any officer or officers of any such town or city, failing, refusing or neglecting to comply with any such order of court, shall be deemed guilty of a misdemeanor, and shall be fined and imprisoned as for a contempt of court.