def _check_axis_in_range(axis, ndim):
    """Checks axes are with the bounds of ndim"""
    if -ndim <= axis < ndim:
        return True
    raise ValueError(
        f'axis {axis} is out of bounds for array of dimension {ndim}')