def getRange(vals, val):
    """ Returns the position in a descending range of values
    E.g, [10,5,2]
    Returns 0:x>=10, 1:x>5, 2:x>2, 3:x<=2"""
    for i in range(len(vals) + 1):
        if (i == 0):
            if (val >= vals[i]): return i
        elif (i == len(vals)):
            if (val <= vals[i - 1]): return i
        else:
            if (val > vals[i]): return i
    return 0