When an assessment or a portion of an assessment has been illegally levied and has been collected and no lien has attached to the funds so collected, the commissioners may use those funds, or any part thereof, for the purposes for which the assessment was levied, or they may petition the court in which the assessment was levied for authority to rebate the balance of such funds remaining after the payment of the costs and expenses incident to the levy of the assessment and the collection of the assessment and the rebate thereof. Upon the filing of the petition it shall be presented to the court and set for hearing. The clerk of the court shall give notice of the hearing in substantially the form provided in Section 4--21 and in the manner and for the length of time provided in Section 4--22. Any person interested may appear at the hearing and show cause why a rebate should or should not be made. The court may, upon the conclusion of the hearing, order the commissioners to rebate such balance or a portion thereof or order the commissioners to retain the same, or a portion thereof, to be used for the purposes for which the assessment was levied or for the general purposes of the district.
70 ILCS 605/5-27