In all proceedings for the partition of real estate, when the rights and interests of all the parties in interest are properly set forth in the complaint, the court shall apportion the costs among the parties in interest in the action, including the necessary expense of procuring such evidence of title to the real estate as is usual and customary for making sales of real estate, and a reasonable fee for plaintiff's attorney, so that each party shall pay his or her equitable portion thereof, unless the defendants, or some of them, interpose a good and substantial defense to the complaint. In such case the party or parties making such substantial defense shall recover their costs against the plaintiff according to justice and equity.
735 ILCS 5/17-125