def encode(self, data):
        """
        Write to the request, automatically compressing data on the fly.
        """
        if not self._request.startedWriting:
            # Remove the content-length header, we can't honor it
            # because we compress on the fly.
            self._request.responseHeaders.removeHeader(b'content-length')
        return self._zlibCompressor.compress(data)

        Write to the request, automatically compressing data on the fly.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/server.py