Whenever any portion of a district is included within a city by reason of incorporation, annexation, or otherwise, such portion may be withdrawn from the district. Such withdrawal shall be effective upon the filing with the State Board of Equalization, the governing body of the district, and the county assessor, of copies of a resolution of the legislative body of the city, describing the included portion, and declaring such portion withdrawn. Upon the withdrawal of any territory of a district, all property acquired for the district and all unencumbered funds on the date of withdrawal, including all taxes levied and collected by the district in any year in which taxes are levied and collected by the district after the date of withdrawal on property withdrawn from the district, shall be divided between the city and the remaining district in proportion to the assessed value of the real property of the territory so withdrawn and the portion remaining. For the purpose of this article, the unencumbered funds are the sum of money, uncollected taxes, and other uncollected accounts belonging to or due such district, in excess of an amount sufficient to pay all claims and accounts against the district.