def validate_minmax_axis(axis):
    """
    Ensure that the axis argument passed to min, max, argmin, or argmax is
    zero or None, as otherwise it will be incorrectly ignored.

    Parameters
    ----------
    axis : int or None

    Raises
    ------
    ValueError
    """
    ndim = 1
    if axis is None:
        return
    if axis >= ndim or axis < 0 and ndim + axis < 0:
        raise ValueError(
            f'`axis` must be fewer than the number of dimensions ({ndim})')
