The city may guarantee the payment of the whole or any part of the bonds issued against a local improvement district, but the guaranties on the part of the city, other than a city operating under the council-manager form or the commission form, shall be made only by ordinance passed by the vote of not less than nine councilmembers and the approval of the mayor in noncharter code cities that retained the old second-class city plan of government with twelve council positions, and six councilmembers and approval of the mayor in cities of the second class. In a city under the council-manager form of government, such guaranties shall be made only in an ordinance passed by a vote of three out of five or five out of seven councilmembers, as the case may be, and approval of the mayor. In a city under the commission form of government, such guaranties shall be made only in an ordinance passed by a vote of two out of three of the commissioners. The mayor's approval shall not be necessary in commission form cities.