code: def get_token(username, length=20, timeout=20):
      
      redis = get_redis_client()
      token = get_random_string(length)
      token_key = 'token:{}'.format(token)
      redis.set(token_key, username)
      redis.expire(token_key, timeout)
      return token
docs: Obtain an access token that can be passed to a websocket client.