code: def _get_axis(array, axis, fname):
      """
      axis = _get_axis(array, axis, fname)
      Checks that ``axis`` is a valid axis of ``array`` and normalises it.
      Parameters
      ----------
      array : Tensor
      axis : int
      fname : str
          Function name. Used in error messages
      Returns
      -------
      axis : int
          The positive index of the axis to use
      """
      if axis < 0:
          axis += len(array.shape)
  
      if not (0 <= axis < len(array.shape)):
          raise ValueError(
              f"caer.{fname}: `axis` is out of bounds (maximum was {array.ndim}, got {axis})"
          )
  
      return axis
  
file_path: caer/caer/_internal.py
imports: import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: _get_axis(array, axis, fname) and returns: axis