; (B) the duration of the alien’s residence in the United States; (C) evidence of rehabilitation, if applicable; and (D) the extent to which the alien’s removal, or the denial of the alien’s application, would adversely affect the alien or the alien’s United States citizen or lawful permanent resident family members. . (b) Waiver of grounds of deportability Section 237(a) of the Immigration and Nationality Act ( 8 U.S.C. 1227(a) ) is amended by adding at the end the following: (8) Humanitarian, family unity, and public interest waiver (A) In general Notwithstanding any other provision of law, except section 245B(c)(1)(B), the Secretary of Homeland Security or the Attorney General may waive the operation of any 1 or more grounds of deportability under this subsection (excluding deportability under paragraph (2)(A)(iii) based on a conviction described in section 101(a)(43)(A) and deportability under paragraph (4)) for any purpose, including eligibility for relief from removal— (i) for humanitarian purposes; (ii) to ensure family unity; or (iii) if a waiver is otherwise in the public interest. (B) Considerations In making a determination under subparagraph (A), the Secretary of Homeland Security or the Attorney General shall consider all mitigating and aggravating factors, including— (i) the severity of the underlying circumstances, conduct, or violation; (ii) the duration of the alien’s residence in the United States; (iii) evidence of rehabilitation, if applicable