def XYZtoYxy(X, Y, Z):
    """ convert XYZ to Yxy color
    :param X: X value
    :param Y: Y value (luminance)
    :param Z: Z value
    :return: Yxy tuple """
    tmp_sum = X + Y + Z

    if tmp_sum == 0.0:
        x, y = 0.0, 0.0
    else:
        # Y = Y     # not needed
        x = X / tmp_sum
        y = Y / tmp_sum

    return Y, x, y