def _read_pypi_response(self, response):
        """Read and decode a PyPI HTTP response."""
        import cgi

        content_type = response.getheader('content-type', 'text/plain')
        encoding = cgi.parse_header(content_type)[1].get('charset', 'ascii')
        return response.read().decode(encoding)
Read and decode a PyPI HTTP response.
product/gradle-plugin/src/main/python/setuptools/_distutils/config.py