(data, compresslevel=9)
return buf.getvalue()
Compress data in one shot and return the compressed string.
    Optional argument is the compression level, in range of 1-9.
Compress data in one shot and return the compressed string.
    Optional argument is the compression level, in range of 1-9.
Compress data in one shot and return the compressed string . Optional argument is the compression level in range of 1 - 9 .
def compress(data, compresslevel=9):
    """Compress data in one shot and return the compressed string.
    Optional argument is the compression level, in range of 1-9.
    """
    buf = io.BytesIO()
    with GzipFile(fileobj=buf, mode='wb', compresslevel=compresslevel) as f:
        f.write(data)
    return buf.getvalue()
def compress ( data , compresslevel = 9 ) : buf = io . BytesIO ( ) with GzipFile ( fileobj = buf , mode = 'wb' , compresslevel = compresslevel ) as f : f . write ( data ) return buf . getvalue ( )