def clamp(number: float, min_val: float, max_val: float) -> float:
    """Retuned the value of number clamped between min_val and max_val.

    Args:
        - number: The number to be clamped.
        - min_val: The minimum value of the returned number.
        - max_val: The maximum value of the returned number.

    Preconditions:
        - min_val <= max_val

    >>> clamp(0.0, 1.0, 2.0)
    1.0
    >>> clamp(5.0, 1.0, 2.0)
    2.0
    >>> clamp(1.5, 1.0, 2.0)
    1.5
    """
    return max(min_val, min(max_val, number))