def _handleResponse(self, response):
        """
        Check if the response is encoded, and wrap it to handle decompression.
        """
        contentEncodingHeaders = response.headers.getRawHeaders(
            b'content-encoding', [])
        contentEncodingHeaders = b','.join(contentEncodingHeaders).split(b',')
        while contentEncodingHeaders:
            name = contentEncodingHeaders.pop().strip()
            decoder = self._decoders.get(name)
            if decoder is not None:
                response = decoder(response)
            else:
                # Add it back
                contentEncodingHeaders.append(name)
                break
        if contentEncodingHeaders:
            response.headers.setRawHeaders(
                b'content-encoding', [b','.join(contentEncodingHeaders)])
        else:
            response.headers.removeHeader(b'content-encoding')
        return response

        Check if the response is encoded, and wrap it to handle decompression.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/client.py