code: def _find_time_like(coordmap, fix0):
      """Return input axis corresponding to best time-like axis
  
      Parameters
      ----------
      coordmap : AffineTransform
      fix0 : bool
          True if we use zero column, zero row heuristic to match time input and
          output axes.
  
      Returns
      -------
      in_ax : int or None
          None if there was no time-like axis that could be mapped to an input,
          otherwise the input axis index.
      out_ax : int or None
          None if there was no time-like axis that could be mapped to an input,
          otherwise the input axis index.
      tl_name: str or None:
          None if there was no time-like axis that could be mapped to an input,
          otherwise the canonical name of this time-like.
      """
      non_space_inames = list(coordmap.function_domain.coord_names[3:])
      non_space_onames = list(coordmap.function_range.coord_names[3:])
      # Make time-like names canonical, set to None elsewhere
      for ax_names in [non_space_inames, non_space_onames]:
          for ax_no, ax_name in enumerate(ax_names):
              ax_names[ax_no] = TIME_LIKE_MAP.get(ax_name)
      # Find best time in axis, check correspondence
      in2out, out2in = axmap(coordmap, "both", fix0)
      in_ax, out_ax = None, None
      for name in TIME_LIKE_ORDERED:
          if name in non_space_inames:
              in_ax = non_space_inames.index(name) + 3
              corr_out = in2out[in_ax]
              if name in non_space_onames:  # in both - matching?
                  same_time_out = non_space_onames.index(name) + 3
                  corr_in = out2in[same_time_out]
                  if corr_out is None:
                      if corr_in is not None:
                          raise NiftiError(
                              "Axis type '%s' found in input and "
                              "output but they do not appear to "
                              "match" % name
                          )
                      return (in_ax, None, name)
                  if corr_out != same_time_out:
                      raise NiftiError(
                          "Axis type '%s' found in input and "
                          "output but they do not appear to "
                          "match" % name
                      )
                  return (in_ax, corr_out, name)
              # Name not in output, but is there another time-like name at this
              # output position?
              matching = non_space_onames[corr_out - 3]
              if matching is None:
                  return (in_ax, corr_out, name)
              raise NiftiError(
                  "Axis type '{}' in input matches axis type '{}' "
                  "in output".format(name, matching)
              )
          # Now check in output names
          elif name in non_space_onames:
              # Found name in output axes, corresponding input?
              out_ax = non_space_onames.index(name) + 3
              in_ax = out2in[out_ax]
              if in_ax is None:  # no corresponding axis
                  continue
              matching = non_space_inames[in_ax - 3]
              if matching is None:
                  return (in_ax, out_ax, name)
              raise NiftiError(
                  f"Axis type '{name}' in output matches axis type "
                  f"'{matching}' in input"
              )
      return None, None, None
  
file_path: nipy/nipy/io/nifti_ref.py
imports: import sys
  import warnings
  from copy import copy
  import nibabel
  import numpy
  from nibabel.affines import from_matvec, to_matvec
  from ..core.image.image import Image
  from ..core.image.image_spaces import as_xyz_image
  from ..core.reference import spaces
  from ..core.reference.coordinate_map import AffineTransform
  from ..core.reference.coordinate_map import axmap
  from ..core.reference.coordinate_map import product
  from ..core.reference.coordinate_system import CoordinateSystem
  from .nibcompat import get_affine, get_header
label_desc: Use image node_id 2 for calling a global function with example usage: _find_time_like(coordmap, fix0) and returns: None,  None,  None, in_ax,  corr_out,  name, in_ax,  corr_out,  name, in_ax,  None,  name, in_ax,  out_ax,  name