a married individual (within the meaning of section 7703), this section shall apply only if the taxpayer and the taxpayer’s spouse file a joint return for the taxable year. (8) Nonresident aliens If the taxpayer is a nonresident alien individual for any portion of the taxable year, this section shall apply only if such individual is treated as a resident alien of the United States for purposes of this chapter by reason of an election under subsection (g) or (h) of section 6013. (e) Election not To have section apply A taxpayer may elect not to have this section apply with respect to the qualified tuition and related expenses of an individual for any taxable year. (f) Definitions For purposes of this section: (1) Eligible student The term eligible student means, with respect to any taxable year, an individual who— (A) is enrolled for at least one academic period which begins during such taxable year at an eligible educational institution, and (B) meets the requirements of section 484(a)(1) of the Higher Education Act of 1965, as in effect on the date of the enactment of the Expand American Educational Opportunity Act of 2017 . (2) Qualified tuition and related expenses (A) In general The term qualified tuition and related expenses means tuition, fees, and course materials required for the enrollment or attendance of— (i) the taxpayer, (ii) the taxpayer’s spouse, or (iii) any dependent of the taxpayer with respect to whom the taxpayer is allowed a deduction under section 151, at an eligible educational institution for courses of instruction of such individual at such institution. (B) Exception for education involving sports, etc Such term does not include expenses with respect to any course or other education involving sports, games, or hobbies, unless such course or other education is part of the individual’s degree program. (C) Exception for nonacademic fees Such term does not include student activity fees, athletic fees, insurance expenses, or other expenses unrelated to an individual’s academic course of