(a) Whenever necessary to make an inspection to enforce any of the provisions of this chapter, or whenever the building official has reasonable cause to believe there exists any condition or code violation which makes a building, structure, or premises, or electrical, gas, mechanical or plumbing system unsafe, dangerous or hazardous, the building official may enter such building, structure or premises at all reasonable times to inspect the same or to perform any duty imposed upon the building official by these technical codes. If such building or premises is occupied, he or she shall first present proper credentials and request entry. If such building, structure or premises is unoccupied, he or she shall first make a reasonable effort to locate the owner or other persons having charge or control of such and request entry. If entry is refused, the building official shall have recourse to every remedy provided by law to secure entry, including the procurement of a warrant from the magistrate. (b) After the building official has obtained a proper inspection warrant or other remedy provided by law to secure entry, no owner or occupant or any other persons having charge, care or control of any building, structure or premises shall fail to promptly permit entry therein by the building official for the purpose of inspection and examination pursuant to this chapter.