def _crop(x, low=0, high=1):
    """Crop a number to an interval.

    Parameters
    ----------
    x : Number
    low : Number
    high : Number

    Returns
    -------
    Number
        `x` in the general case, but `low` if `x` is lower and `high` if `x` is higher.

    Examples
    --------
        >>> _crop(- 0.2)
        0
        >>> _crop(0.5)
        0.5
        >>> _crop(1.5)
        1
    """
    return min(max(x, low), high)
