def limit(value, limits):
    """
    :param <float> value: value to limit
    :param <list>/<tuple> limits: (min, max) limits to which restrict the value
    :return <float>: value from within limits, if input value readily fits into the limits its left unchanged. If value exceeds limit on either boundary its set to that boundary.
    """
    if value < limits[0]:
        value = limits[0]
    elif value > limits[1]:
        value = limits[1]
    else:
        pass
    return value