Section 50. Any person who hinders or prevents or attempts to prevent the commissioner, the chief of inspections of the department or any inspector or local inspector from entering any building, structure or enclosure or part thereof in the performance of his duty in the enforcement of the laws of the commonwealth relating thereto shall be punished by a fine of not less than fifty nor more than one hundred dollars. The word ''inspector'' as used in this section, shall include an inspector of buildings of a city or town, or of a district referred to in section four A of chapter twenty-two.