code: def _decode_response(response):
      
      content_type = response.headers.get('content-type', '')
      logger.debug("status[%s] content_type[%s] encoding[%s]" %
                   (response.status_code, content_type, response.encoding))
      response.raise_for_status()
      content = response.content.strip()
      if response.encoding:
          content = content.decode(response.encoding)
      if not content:
          logger.debug("no content in response")
          return content
      if content_type.split(';')[0] != 'application/json':
          return content
      if content.startswith(GERRIT_MAGIC_JSON_PREFIX):
          content = content[len(GERRIT_MAGIC_JSON_PREFIX):]
      try:
          return json.loads(content)
      except ValueError:
          logger.error('Invalid json content: %s', content)
          raise
docs: Strip off Gerrit's magic prefix and decode a response.
  
      :returns:
          Decoded JSON content as a dict, or raw text if content could not be
          decoded as JSON.
  
      :raises:
          requests.HTTPError if the response contains an HTTP error status code.