Cities or counties or fire protection districts may contract with the department for assistance by the department in the enforcement of the applicable provisions of this part, the building standards published in the State Building Standards Code, and the other rules and regulations promulgated pursuant to the provisions of this part within such cities or counties. Such contracts shall contain provisions for the payment of the costs of such enforcement, or portions thereof, as may be determined by the department.