human
Complete the below
def data_sharing_consent_required(view_func):

    ''''Decorator which makes a view method redirect to the Data Sharing Consent form if:
    * The wrapped method is passed request, course_id as the first two arguments.
    * Enterprise integration is enabled
    * Data sharing consent is required before accessing this course view.
    * The request.user has not yet given data sharing consent for this course.
    After granting consent, the user will be redirected back to the original request.path.'
    '''

Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.
    @wraps(view_func)
    def inner(request, course_id, *args, **kwargs):
        '\n                                Redirect    to    the    consent    page    if    the    request.user    must    consent    to    data    sharing    before    viewing    course_id.\n\n                                Otherwise,    just    call    the    wrapped    view    function.\n                                '
        consent_url = get_enterprise_consent_url(request, course_id)
        if consent_url:
            real_user = getattr(request.user, 'real_user', request.user)
            LOGGER.warning(u'User    %s    cannot    access    the    course    %s    because    they    have    not    granted    consent', real_user, course_id)
            return redirect(consent_url)
        return view_func(request, course_id, *args, **kwargs)
    return inner