When the estate of a tenant for life or years in a undivided part of the property in question is admitted by the parties or ascertained by the court to be existing at the time of the order of sale, and the person entitled to that estate is a party to the action, the estate may be first set off out of a part of the property and a sale made of that part, subject to the estate of that tenant in that part. But, if in the judgment of the court a due regard to the interest of all the parties requires the sale of that estate also, the sale may be ordered.