code: def gzip_encode(data):
      
      if not gzip:
          raise NotImplementedError
      f = StringIO.StringIO()
      gzf = gzip.GzipFile(mode="wb", fileobj=f, compresslevel=1)
      gzf.write(data)
      gzf.close()
      encoded = f.getvalue()
      f.close()
      return encoded
docs: data -> gzip encoded data
  
      Encode data using the gzip content encoding as described in RFC 1952