royalty, which is received or accrued from a related person (within the meaning of section 954(b)) to the extent that such amount is properly allocable (under regulations prescribed by the Secretary) to income of such related person which is not passive income. . (20) The following sections are amended by striking 954(d)(3) each place it appears and inserting 954(b) : (A) Section 958(b). (B) Section 988(a)(3)(C). (C) Subsections (d)(3)(A) and (e)(2)(B)(i) of section 1298. (D) Section 1471(e)(2). (E) Section 3121(z)(2). (21) The table of sections for subpart F of part III of subchapter N of chapter 1 is amended by striking the items relating to sections 952 through 956 and inserting the following: Sec. 952. Subpart F income defined. Sec. 953. Active foreign market income. Sec. 954. Definition of passive income. Sec. 955. Definition of insurance income. Sec. 956. Special rule for certain captive insurance companies. . (h) Effective dates (1) In general Except as provided in paragraph (2), the amendments made by this section shall apply to taxable years of foreign corporations beginning on or after the applicable date, and to taxable years of United States shareholders with or within which such taxable years of foreign corporations end. (2) Gains and losses from the sale of CFC stock