For the sole purpose of determining the amount of distributable net income in the application of sections
661 and
662, in the case of a single trust having more than one beneficiary, substantially separate and independent shares of different beneficiaries in the trust shall be treated as separate trusts. Rules similar to the rules of the preceding provisions of this subsection shall apply to treat substantially separate and independent shares of different beneficiaries in an estate having more than 1 beneficiary as separate estates. The existence of such substantially separate and independent shares and the manner of treatment as separate trusts or estates, including the application of subpart D, shall be determined in accordance with regulations prescribed by the Secretary.