; or (B) transactions that are necessary for or related to the activities described in subparagraph (A). (2) Definitions In this subsection: (A) Agricultural commodity The term agricultural commodity has the meaning given that term in section 102 of the Agricultural Trade Act of 1978 ( 7 U.S.C. 5602 ). (B) Medical device The term medical device has the meaning given the term device in section 201 of the Federal Food, Drug, and Cosmetic Act ( 21 U.S.C. 321 ). (C) Medicine The term medicine has the meaning given the term drug in section 201 of the Federal Food, Drug, and Cosmetic Act ( 21 U.S.C. 321 ). (g) Exception for safety of vessels and crew Sanctions under this section shall not apply with respect to a person providing provisions to a vessel otherwise subject to sanctions under this section if such provisions are intended for the safety and care of the crew aboard the vessel, the protection of human life aboard the vessel, or the maintenance of the vessel to avoid any environmental or other significant damage. (h) Waiver (1) In general The President may, on a case-by-case basis and for periods not to exceed 180 days each, waive the application of sanctions imposed with respect to a foreign person under this section if the President certifies to the appropriate congressional committees, not later than 15 days after such waiver is to take effect, that the waiver is vital to the national interests of the United States. (2) Special rule The President shall not be required to impose sanctions under this section with respect to a foreign person described in subsection (a) if the President certifies in writing to the appropriate congressional committees that the foreign person— (A) is no longer engaging in activities described in subsection (b)