(a) Building officers and their duly authorized inspectors are hereby empowered, during reasonable hours, to lawfully enter upon any premises or into any building or structure, or portion thereof, whether completed or in process of construction, alteration or repair, when necessary to do so in the performance of any duty imposed upon them by this chapter or the provisions of the zoning ordinance or any order or resolution of the president and board of trustees.
(b) It shall be unlawful for any person to hinder or prevent, or attempt to hinder or prevent, any such building officers or their duly authorized inspectors from performing their respective duties. Any person hindering or attempting to hinder, resisting or attempting to resist, any building officer in the performance of his or her duty shall be charged with resisting an officer; and the person convicted of such offense shall be subject to the penalty provided for in § 16-l.