'Initialize for writing with gzip compression.'

def _init_write_gz(self):

    self.cmp = self.zlib.compressobj(9, self.zlib.DEFLATED, (- self.zlib.MAX_WBITS), self.zlib.DEF_MEM_LEVEL, 0)
    timestamp = struct.pack('<L', int(time.time()))
    self.__write((('\x1f\x8b\x08\x08' + timestamp) + '\x02\xff'))
    if self.name.endswith('.gz'):
        self.name = self.name[:(-3)]
    self.__write((self.name.encode('iso-8859-1', 'replace') + NUL))
