def j2bgColorFromMeas(meas, tolerance):
    """Return a color based on whether or not meas is within the profilometry tolerance range
    """
    if meas is None:
        return ""
    if str(meas) in ["NaN", "nan"] or str(meas) == "Err":
        return "danger"
    if abs(float(meas)) > float(tolerance[0]):
        bgColor = "danger"
    elif abs(float(meas)) < float(tolerance[1]):
        bgColor = "info"
    else:
        bgColor = "success"
    return bgColor