code: def product(*cmaps, **kwargs):
      """ "topological" product of two or more mappings
  
      The mappings can be either AffineTransforms or CoordinateMaps.
  
      If they are all AffineTransforms, the result is an AffineTransform,
      else it is a CoordinateMap.
  
      Parameters
      ----------
      cmaps : sequence of CoordinateMaps or AffineTransforms
  
      Returns
      -------
      cmap : ``CoordinateMap``
  
      Examples
      --------
      >>> inc1 = AffineTransform.from_params('i', 'x', np.diag([2,1]))
      >>> inc2 = AffineTransform.from_params('j', 'y', np.diag([3,1]))
      >>> inc3 = AffineTransform.from_params('k', 'z', np.diag([4,1]))
  
      >>> cmap = product(inc1, inc3, inc2)
      >>> cmap.function_domain.coord_names
      ('i', 'k', 'j')
      >>> cmap.function_range.coord_names
      ('x', 'z', 'y')
      >>> cmap.affine
      array([[ 2.,  0.,  0.,  0.],
             [ 0.,  4.,  0.,  0.],
             [ 0.,  0.,  3.,  0.],
             [ 0.,  0.,  0.,  1.]])
  
      >>> A1 = AffineTransform.from_params('ij', 'xyz', np.array([[2,3,1,0],[3,4,5,0],[7,9,3,1]]).T)
      >>> A2 = AffineTransform.from_params('xyz', 'de', np.array([[8,6,7,4],[1,-1,13,3],[0,0,0,1]]))
  
      >>> A1.affine
      array([[ 2.,  3.,  7.],
             [ 3.,  4.,  9.],
             [ 1.,  5.,  3.],
             [ 0.,  0.,  1.]])
      >>> A2.affine
      array([[  8.,   6.,   7.,   4.],
             [  1.,  -1.,  13.,   3.],
             [  0.,   0.,   0.,   1.]])
  
      >>> p=product(A1, A2)
      >>> p.affine
      array([[  2.,   3.,   0.,   0.,   0.,   7.],
             [  3.,   4.,   0.,   0.,   0.,   9.],
             [  1.,   5.,   0.,   0.,   0.,   3.],
             [  0.,   0.,   8.,   6.,   7.,   4.],
             [  0.,   0.,   1.,  -1.,  13.,   3.],
             [  0.,   0.,   0.,   0.,   0.,   1.]])
  
      >>> np.allclose(p.affine[:3,:2], A1.affine[:3,:2])
      True
      >>> np.allclose(p.affine[:3,-1], A1.affine[:3,-1])
      True
      >>> np.allclose(p.affine[3:5,2:5], A2.affine[:2,:3])
      True
      >>> np.allclose(p.affine[3:5,-1], A2.affine[:2,-1])
      True
      >>>
  
      >>> A1([3,4])
      array([ 25.,  34.,  26.])
      >>> A2([5,6,7])
      array([ 129.,   93.])
      >>> p([3,4,5,6,7])
      array([  25.,   34.,   26.,  129.,   93.])
      """
      # First, check if they're all Affine
      allaffine = np.all(
          [isinstance(cmap, AffineTransform) for cmap in cmaps]
      )
      if allaffine:
          return _product_affines(*cmaps, **kwargs)
      else:
          warnings.warn(
              "product of non-affine CoordinateMaps is less robust than"
              + "the AffineTransform"
          )
          return _product_cmaps(
              *[_as_coordinate_map(cmap) for cmap in cmaps], **kwargs
          )
  
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 1 for calling a global function with example usage: product() and returns: _product_affines, _product_cmaps