def in_range(val, min_val, max_val):
    """Make sure val is within min_val, max_val

    >>> in_range(5, 0, 10)
    5

    >>> in_range(0, -10, 10)
    0

    >>> in_range(0, 10, 20)
    10

    >>> in_range(100, 0, 10)
    10
    """
    return min(max(val, min_val), max_val)
