purposes of subclause (I), the suitability of a unit for occupancy shall be determined under regulations prescribed by the Secretary taking into account local health, safety, and building codes. (III) Single-room occupancy units For purposes of subclause (I), a single-room occupancy unit shall not be treated as used on a transient basis merely because it is rented on a month-by-month basis. (C) Special rule for buildings having 4 or fewer units In the case of any building which has 4 or fewer residential rental units, no unit in such building shall be treated as a middle-income unit if the units in such building are owned by— (i) any individual who occupies a residential unit in such building, or (ii) any person who is related (as defined in subsection (d)(2)(D)(ii)) to such individual. (D) Rules relating to students (i) In general A unit occupied solely by individuals who— (I) have not attained age 24, and (II) are enrolled in a full-time course of study at an institution of higher education (as defined in section 3304(f)), shall not be treated as a middle-income unit. (ii) Exceptions Clause (i) shall not apply to a unit occupied by an individual who— (I) is married, if such individual's spouse also occupies the unit, (II) is a person with disabilities (as defined in section 3(b)(3)(E) of the United States Housing Act of 1937), (III) is a veteran (as defined in section 101(2) of title 38, United States Code), (IV) has one or more qualifying children (as defined in section 152(c)), if such children also occupy the unit, the individual is not a dependent (as defined in section 152, determined without regard to subsections (b)(1), (b)(2), and (d)(1)(B) thereof) of another individual, and such children are not claimed as dependents (as so defined) of another individual, or (V) is, or was immediately prior to attaining the age of majority— (aa) an emancipated minor or in legal guardianship as determined by a court of competent jurisdiction in the individual's State of legal residence, (bb) under the care and