import base64
import lzma
import json


def decompress_cst(data):
    """
    Transforms a huge constant produced by function @see fn compress_cst
    into the original value.

    :param data: data
    :param length: line length
    :param as_text: returns the results as text
    :return: results

    .. runpython::
        :showcode:

        from pyquickhelper.pycode.unittest_cst import compress_cst, decompress_cst

        data = {'values': [0.5, 6.9]}
        cp = compress_cst(data)
        back = decompress_cst(cp)
        print(back)
    """
    if isinstance(data, list):
        data = b"".join(data)
    data64 = base64.b64decode(data)
    data_in = lzma.decompress(data64)
    dec = data_in.decode('utf-8')
    return json.loads(dec)