code: def _check_axes(axes, ndim):
      if axes is None:
          return tuple(range(ndim))
      elif numpy.isscalar(axes):
          axes = (operator.index(axes),)
      elif isinstance(axes, Iterable):
          for ax in axes:
              axes = tuple(operator.index(ax) for ax in axes)
              if ax < -ndim or ax > ndim - 1:
                  raise ValueError(
                      f"specified axis: {ax} is out of range"
                  )
          axes = tuple(ax % ndim if ax < 0 else ax for ax in axes)
      else:
          message = (
              "axes must be an integer, iterable of integers, or None"
          )
          raise ValueError(message)
      if len(tuple(set(axes))) != len(axes):
          raise ValueError("axes must be unique")
      return axes
  
file_path: scipy/scipy/ndimage/_ni_support.py
imports: from collections.abc import Iterable
  import operator
  import warnings
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: _check_axes(axes, ndim) and returns: axes, tuple