Section 22. Notwithstanding the provisions any general or special law to the contrary, the municipalities of an abolished county shall be deemed to have accepted the provisions of section 147A of chapter 140, and shall enact by-laws to provide for the functions performed by the abolished government of a county with respect to dogs pursuant to sections 136A to 174D, inclusive, of said chapter 140, as of July 11, 1997. The balance of funds remaining in the dog fund of an abolished county as of the transfer date shall be disbursed forthwith by the state treasurer in the manner prescribed by section 172 of said chapter 140 to the treasurer of each city and town, who shall maintain a separate dog fund consistent with the by-laws adopted by the city or town and said sections 136A to 174D, inclusive, of said chapter 140.