If property used directly in the performance of the exempt function of an organization described in paragraph (7), (9), (17), or (20) of section
501
(c) is sold by such organization, and within a period beginning 1 year before the date of such sale, and ending 3 years after such date, other property is purchased and used by such organization directly in the performance of its exempt function, gain (if any) from such sale shall be recognized only to the extent that such organization’s sales price of the old property exceeds the organization’s cost of purchasing the other property. For purposes of this subparagraph, the destruction in whole or in part, theft, seizure, requisition, or condemnation of property, shall be treated as the sale of such property, and rules similar to the rules provided by subsections (b), (c), (e), and (j) of section
1034 (as in effect on the day before the date of the enactment of the Taxpayer Relief Act of 1997) shall apply.