code: def create_session(username, password):
      
      user = User.objects.get_user_by_password(username, password)
      auth_session_engine = get_config('auth_session_engine')
      if not user:
          raise InvalidInput('Username or password incorrect')
      session_key = random_string(15)
      while auth_session_engine.get(session_key):
          session_key = random_string(15)
      auth_session_engine.set(session_key, user.username, get_config('auth_session_expire'))
      return {'session_key': session_key, 'user': user}
docs: Create a session for the user, and then return the key.