def XYZ_to_RGB(XYZ, colorspace, clamp=False):
    matrix = get_XYZ_to_RGB_matrix(colorspace.get_red_primaries(),
                                   colorspace.get_green_primaries(),
                                   colorspace.get_blue_primaries(),
                                   colorspace.get_white_point()
                                   )
    # apply matrix
    RGB = apply_matrix(matrix, XYZ)
    # apply gradation
    RGB = [colorspace.encode_gradation(value) for value in RGB]
    # clamp
    if clamp:
        RGB = [clamp_value(value) for value in RGB]
    return RGB
:return: A 4-tuple (markup, original encoding, encoding
dataset/ETHPy150Open mikrosimage/ColorPipe-tools/utils/colors_helper.py/XYZ_to_RGB--crossover with--dataset/ETHPy150Open akalongman/sublimetext-codeformatter/codeformatter/lib/htmlbeautifier/bs4/builder/_htmlparser.py/HTMLParserTreeBuilder.prepare_markup