Section 57. The supreme judicial court or superior court shall have jurisdiction in equity to enforce the provisions of this chapter, the provisions of the state building code, and of any ordinance, by-law, rule or regulation made under authority of any of such provisions, the enforcement of which, under this chapter, is the responsibility of an inspector or local inspector; to enjoin violations thereof; and to restrain the use and occupation of any building subject to any provision of this chapter during the period of noncompliance with any order of such inspector or local inspector or such authorized representative or of the court.