def METHOD_NAME(self, request, course_key, user):
    """
    Handle the marketing email opt-in flag, if it was set.
    Errors here aren't expected, but should not break the outer enrollment transaction.
    """
    email_opt_in = request.data.get('email_opt_in', None)
    if email_opt_in is not None:
        try:
            update_email_opt_in(user, course_key.org, email_opt_in)
        except Exception:  # pylint: disable=broad-except
            # log the error, return silently
            log.exception(
                'Failed to handle marketing opt-in flag: user="%s", course="%s"', user.username, course_key
            )