def METHOD_NAME(lossval):
    if lossval in (None, float("inf")):
        return 1, 1, 1
    else:
        t = (lossval - loss_min) / (loss_max - loss_min + 0.0001)
        if lossval < colorize_thresh:
            return 0.0, 1.0 - t, 0.0  # -- red best black worst
        else:
            return t, t, t  # -- white=worst, black=best