(data)
return f.getvalue()
data -> gzip encoded data

    Encode data using the gzip content encoding as described in RFC 1952
data -> gzip encoded data
data - > gzip encoded data
def gzip_encode(data):
    """data -> gzip encoded data

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