def answer(self, (responsecode, responsestring, headers, data)):
        if self.closed:
            return
        if self.encoding == 'gzip':
            compressed = StringIO()
            gz = GzipFile(fileobj = compressed, mode = 'wb', compresslevel = 9)
            gz.write(data)
            gz.close()
            cdata = compressed.getvalue()
            if len(data) >= len(cdata):
                self.encoding = 'identity'
            else:
                if DEBUG:
                   print "Compressed: %i  Uncompressed: %i\n" % (len(cdata),len(data))
                data = cdata
                headers['Content-Encoding'] = 'gzip'

        # i'm abusing the identd field here, but this should be ok
        if self.encoding == 'identity':
            ident = '-'
        else:
            ident = self.encoding
        self.handler.log( self.connection.get_ip(), ident, '-',
                          self.header, responsecode, len(data),
                          self.headers.get('referer','-'),
                          self.headers.get('user-agent','-') )
        self.done = True
        r = StringIO()
        r.write('HTTP/1.0 ' + str(responsecode) + ' ' + 
            responsestring + '\r\n')
        if not self.pre1:
            headers['Content-Length'] = len(data)
            for key, value in headers.items():
                r.write(key + ': ' + str(value) + '\r\n')
            r.write('\r\n')
        if self.command != 'HEAD':
            r.write(data)
        self.connection.write(r.getvalue())
        if self.connection.is_flushed():
            self.connection.shutdown(1)
dataset/ETHPy150Open Cclleemm/FriendlyTorrent/src/tornado/BitTornado/HTTPHandler.py/HTTPConnection.answer/swapped operands of `>=`