(a) Deduction
In the case of any trust the terms of which—
(1) provide that all of its income is required to be distributed currently, and
(2) do not provide that any amounts are to be paid, permanently set aside, or used for the purposes specified in section 642(c) (relating to deduction for charitable, etc., purposes),
there shall be allowed as a deduction in computing the taxable income of the trust the amount of the income for the taxable year which is required to be distributed currently. This section shall not apply in any taxable year in which the trust distributes amounts other than amounts of income described in paragraph (1).
(b) Limitation on deduction
If the amount of income required to be distributed currently exceeds the distributable net income of the trust for the taxable year, the deduction shall be limited to the amount of the distributable net income. For this purpose, the computation of distributable net income shall not include items of income which are not included in the gross income of the trust and the deductions allocable thereto.