All or any portion of uncollected city taxes, penalties or costs shall be canceled on any of the grounds specified in Section 4986. If the city taxes are collected by the county, the procedure outlined in Section 4986 for the cancellation of taxes, penalties or costs shall be followed, except that the consent of the city attorney, in lieu of the consent of the county legal adviser, is necessary before cancellation. If the taxes are collected by the city, the taxes, penalties, or costs shall be canceled by the officer having custody of the records thereof on order of the governing body of the city, with the written consent of the city attorney.