code: def _response_parser(self, r, expect_json=True, ignore_content=False):
          
          if r.ok:
              try:
                  j = r.json()
                  return Response(j.get('state'), j)
              except ValueError:
                  # No JSON-encoded data returned
                  if expect_json:
                      logger = logging.getLogger(conf.LOGGING_API_LOGGER)
                      logger.debug(r.text)
                      raise InvalidAPIAccess('Invalid API access.')
                  # Raw response
                  if ignore_content:
                      res = Response(True, None)
                  else:
                      res = Response(True, r.text)
                  return res
          else:
              r.raise_for_status()
docs: :param :class:`requests.Response` r: a response object of the Requests
              library
          :param bool expect_json: if True, raise :class:`.InvalidAPIAccess` if
              response is not in JSON format
          :param bool ignore_content: whether to ignore setting content of the
              Response object