'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', long(time.time()))
    self.__write(('\x1f\x8b\x08\x08%s\x02\xff' % timestamp))
    if (type(self.name) is unicode):
        self.name = self.name.encode('iso-8859-1', 'replace')
    if self.name.endswith('.gz'):
        self.name = self.name[:(-3)]
    self.__write((self.name + NUL))
