The city attorney or village attorney shall be the legal advisor of the city council in a city of the second class or village board of trustees. He or she shall commence, prosecute, and defend all suits and actions necessary to be commenced, prosecuted, or defended on behalf of the city or village, or that may be ordered by the city council or village board of trustees. When requested, he or she shall attend meetings of the city council or village board of trustees and give them his or her opinion upon any matters submitted to him or her, either orally or in writing, as may be required. He or she shall draft or review for legal correctness ordinances, contracts, franchises, and other instruments as may be required, and he or she shall perform such other duties as may be imposed upon him or her by general law or ordinance. The city council or village board of trustees of the city or village shall have the right to pay the city or village attorney compensation for legal services performed by him or her for such city or village on such terms as the city council or village board of trustees and attorney may agree, and to employ additional legal assistance and to pay for such legal assistance out of the funds of the city or village.