def bounded(v, l, u):
    """
    Returns bounded value: l if v < i, u if v > u, l otherwise
    :param v: Value
    :param l: Lower bound
    :param u: Upper bound
    :return:
    """
    return min(max(v, l), u)