Section 35. Any agent or official of the commonwealth or of any county, city or town, or any contractor or sub-contractor, or any agent or person acting on behalf of any contractor or sub-contractor, who violates section thirty, thirty-one or thirty-four shall be punished by a fine of not more than one thousand dollars or by imprisonment for six months, or both.