code: def _compose_affines(*affines):
      """Composition of sequence of affines
  
      Compose hecking the domains and ranges.
      """
      cur = AffineTransform(
          affines[-1].function_domain,
          affines[-1].function_domain,
          np.identity(
              affines[-1].ndims[0] + 1, dtype=affines[-1].affine.dtype
          ),
      )
      for cmap in affines[::-1]:
          if cmap.function_domain == cur.function_range:
              cur = AffineTransform(
                  cur.function_domain,
                  cmap.function_range,
                  np.dot(cmap.affine, cur.affine),
              )
          else:
              raise ValueError(
                  "domains and ranges don't match up correctly"
              )
      return cur
  
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 11 for calling a global function with example usage: _compose_affines() and returns: cur