[docs]defcompress_string(st:str)->bytes:""" Compresses strings using the zlib library. Adapted from a StackOverflow.com solution by Dmitry Skryabin https://stackoverflow.com/a/36056646/7556955 with a modification to set block/chunk size to 500 Mb (5 x 10^8 bytes). :param s: Input string to be compressed :type s: str :return: Compressed string as bytes :rtype: bytes """_st=''.join(st).encode('utf-8')compressed=b''begin=0compressor=zlib.compressobj()try:whilebegin<len(_st):compressed+=compressor.compress(_st[begin:begin+CHUNK_SIZE])begin+=CHUNK_SIZEcompressed+=compressor.flush()exceptzlib.errorase:raiseOasisException("Exception raised in 'compress_string'",e)returncompressed