It shall not be unlawful under section
2000e–2 or
2000e–3 of this title for an employer (or a corporation controlled by an employer), labor organization, employment agency, or joint labor-management committee controlling apprenticeship or other training or retraining (including on-the-job training programs) to take any action otherwise prohibited by such section, with respect to an employee in a workplace in a foreign country if compliance with such section would cause such employer (or such corporation), such organization, such agency, or such committee to violate the law of the foreign country in which such workplace is located.