(a) If there is a deficiency of property of the estate to pay in full all claims which are allowed in a case under this chapter concerning a partnership and with respect to which a general partner of the partnership is personally liable, the trustee shall have a claim against such general partner to the extent that under applicable nonbankruptcy law such general partner is personally liable for such deficiency.
(b) To the extent practicable, the trustee shall first seek recovery of such deficiency from any general partner in such partnership that is not a debtor in a case under this title. Pending determination of such deficiency, the court may order any such partner to provide the estate with indemnity for, or assurance of payment of, any deficiency recoverable from such partner, or not to dispose of property.
The trustee has a claim against the estate of each general partner in such partnership that is a debtor in a case under this title for the full amount of all claims of creditors allowed in the case concerning such partnership. Notwithstanding section 502
of this title, there shall not be allowed in such partner’s case a claim against such partner on which both such partner and such partnership are liable, except to any extent that such claim is secured only by property of such partner and not by property of such partnership. The claim of the trustee under this subsection is entitled to distribution in such partner’s case under section 726(a)
of this title the same as any other claim of a kind specified in such section.
(d) If the aggregate that the trustee recovers from the estates of general partners under subsection (c) of this section is greater than any deficiency not recovered under subsection (b) of this section, the court, after notice and a hearing, shall determine an equitable distribution of the surplus so recovered, and the trustee shall distribute such surplus to the estates of the general partners in such partnership according to such determination.