code: def compressBuffer(buffer):
      
      # http://jython.xhaus.com/http-compression-in-python-and-jython/
      zbuf = cStringIO.StringIO()
      zfile = gzip.GzipFile(mode='wb', fileobj=zbuf, compresslevel=9)
      zfile.write(buffer)
      zfile.close()
      return zbuf.getvalue()
docs: Note that this code compresses into a buffer held in memory, rather
      than a disk file. This is done through the use of cStringIO.StringIO().