def clip(v, vMin, vMax):
    """
    @param v: number
    @param vMin: number (may be None, if no limit)
    @param vMax: number greater than C{vMin} (may be None, if no limit)
    @returns: If C{vMin <= v <= vMax}, then return C{v}; if C{v <
    vMin} return C{vMin}; else return C{vMax}
    """
    try:
        return [clip(x, vMin, vMax) for x in v]
    except __HOLE__:
        if vMin == None:
            if vMax == None:
                return v
            else:
                return min(v, vMax)
        else:
            if vMax == None:
                return max(v, vMin)
            else:
                return max(min(v, vMax), vMin)
dataset/ETHPy150Open rll/lfd/lfd/rapprentice/util.py/clip