The normal handling of `axis` is:
```
if axis is not None:
    if axis < a.ndim:
        axis += a.ndim
    if axis < 0 or axis >= a.ndim:
        raise ValueError(...)
```