'Handle the marketing email opt-in flag, if it was set.
Errors here aren\'t expected, but should not break the outer enrollment transaction.'

def _handle_marketing_opt_in(self, request, course_key, user):

    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:
            log.exception('Failed    to    handle    marketing    opt-in    flag:    user="%s",    course="%s"', user.username, course_key)
