import gzip
s_in = b"Lots of content here"
s_out = gzip.compress(s_in)