This question is tacked several times here and here but not answered completely. As decompression doesn't yield the original string.
>>> s = "some string to test zlib"
>>> z = zlib.compress(s)
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: a bytes-like object is required, not 'str'
>>> z = zlib.compress(s.encode("utf8"))
>>> y = zlib.decompress(z)
>>> y
b'some string to test zlib'
>>> print (s, y)
some string to test zlib b'some string to test zlib'
So decompression returns the original string included in "b''"
>>> p = str(y)
>>> p
"b'some string to test zlib'"
The same behavior by the way with gzip.