import base64
import zlib


def compress_text_to_b64(text):
    """Returns a compressed and b64 encoded string
    """
    if isinstance(text, str):
        text = text.encode()
    return base64.b64encode(zlib.compress(text))