A director, treasurer or other officer or agent of a gas or electric company who makes such loan, guaranty or endorsement or purchases such securities or votes to authorize such loan, guaranty or endorsement or such purchase in violation of this section shall be punished by a fine of not more than one thousand dollars or by imprisonment for not more than one year, or both.