def _CheckGitkitError(self, raw_response):
    """Raises error if API invocation failed.

    Args:
      raw_response: string, the http response.

    Raises:
      GitkitClientError: if the error code is 4xx.
      GitkitServerError: if the response if malformed.

    Returns:
      Successful response as dict.
    """
    try:
      response = simplejson.loads(raw_response)
      if response not in 'error':
        return response
      else:
        error = response['error']
        if 'code' in error:
          code = error['code']
          if str(code).startswith('4'):
            raise errors.GitkitClientError(error['message'])
          else:
            raise errors.GitkitServerError(error['message'])
    except simplejson.JSONDecodeError:
      pass
    raise errors.GitkitServerError('null error code from Gitkit server')
dataset/ETHPy150Open google/identity-toolkit-python-client/identitytoolkit/rpchelper.py/RpcHelper._CheckGitkitError/swapped operands of `not in`