code: def _login(login_func, *args):
      
      response = login_func(*args)
      _fail_if_contains_errors(response)
      user_json = response.json()
      return User(user_json)
docs: A helper function for logging in. It's purpose is to avoid duplicate
      code in the login functions.