code: def input_axis_index(coordmap, axis_id, fix0=True):
      """Return input axis index for `axis_id`
  
      `axis_id` can be integer, or a name of an input axis, or it can be the name
      of an output axis which maps to an input axis.
  
      Parameters
      ----------
      coordmap : AffineTransform
      axis_id : int or str
          If int, then an index of an input axis.  Can be negative, so that -2
          refers to the second to last input axis.  If a str can be the name of an
          input axis, or the name of an output axis that should have a
          corresponding input axis (see Raises section).
      fix0: bool, optional
          Whether to fix potential single 0 on diagonal of affine.  This often
          happens when loading nifti images with TR set to 0.
  
      Returns
      -------
      inax : int
          index of matching input axis. If `axis_id` is the name of an output
          axis, then `inax` will be the input axis that had a 'best' match with
          this output axis.  The 'best' match algorithm ensures that there can
          only be one input axis paired with one output axis.
  
      Raises
      ------
      AxisError: if no matching name found
      AxisError : if name exists in both input and output and they do not map to
          each other
      AxisError : if name present in output but no matching input
      """
      # Lists for .index in python < 2.6
      in_names = list(coordmap.function_domain.coord_names)
      out_names = list(coordmap.function_range.coord_names)
      if isinstance(axis_id, int):
          if axis_id < 0:
              axis_id = len(out_names) + axis_id
          return axis_id
      in_in = axis_id in in_names
      in_out = axis_id in out_names
      if not in_in and not in_out:
          raise AxisError(
              f'Name "{axis_id}" not in input or output names'
          )
      if in_in:
          in_no = in_names.index(axis_id)
          if not in_out:
              return in_no
          out2in = axmap(coordmap, "out2in", fix0=fix0)
          if not out2in[axis_id] == in_no:
              raise AxisError(
                  'Name "%s" present in input and output but '
                  "they do not appear to match" % axis_id
              )
          return in_no
      in_no = axmap(coordmap, "out2in", fix0=fix0)[axis_id]
      if in_no is None:
          raise AxisError(
              'Name "%s" present in output but this output axis '
              "does not have the best match with any input axis"
              % axis_id
          )
      return in_no
  
imports: import warnings
  import numpy
  import numpy.linalg
  from nibabel import io_orientation
  from nibabel.affines import from_matvec, to_matvec
  from .coordinate_system import CoordinateSystem, is_coordsys, safe_dtype
  from .coordinate_system import product
label_desc: Use image node_id 19 for calling a global function with example usage: input_axis_index(coordmap, axis_id, fix0) and returns: in_no, axis_id, in_no, in_no