human
Complete the below
def channel_session_user(func):

    ''''Presents a message.user attribute obtained from a user ID in the channel
    session, rather than in the http_session. Turns on channel session implicitly.'
    '''
 ... Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.
    @channel_session
    @functools.wraps(func)
    def inner(message, *args, **kwargs):
        if (not hasattr(message, 'channel_session')):
            raise ValueError('Did    not    see    a    channel    session    to    get    auth    from')
        if (message.channel_session is None):
            from django.contrib.auth.models import AnonymousUser
            message.user = AnonymousUser()
        else:
            fake_request = type('FakeRequest', (object,), {'session': message.channel_session})
            message.user = auth.get_user(fake_request)
        return func(message, *args, **kwargs)
    return inner