code: def slices2aff(slices):
      """Return affine from start, step of sequence `slices` of slice objects
  
      Parameters
      ----------
      slices : sequence of slice objects
  
      Returns
      -------
      aff : ndarray
          If ``N = len(slices)`` then affine is shape (N+1, N+1) with diagonal
          given by the ``step`` attribute of the slice objects (where None
          corresponds to 1), and the `:N` elements in the last column are given by
          the ``start`` attribute of the slice objects
  
      Examples
      --------
      >>> slices2aff([slice(None), slice(None)])
      array([[ 1.,  0.,  0.],
             [ 0.,  1.,  0.],
             [ 0.,  0.,  1.]])
      >>> slices2aff([slice(2, 3, 4), slice(3, 4, 5), slice(4, 5, 6)])
      array([[ 4.,  0.,  0.,  2.],
             [ 0.,  5.,  0.,  3.],
             [ 0.,  0.,  6.,  4.],
             [ 0.,  0.,  0.,  1.]])
      """
      starts = [s.start if s.start is not None else 0 for s in slices]
      steps = [s.step if s.step is not None else 1 for s in slices]
      aff = np.diag(steps + [1.0])
      aff[:-1, -1] = starts
      return aff
  
imports: import numpy
  import scipy.linalg
  from nibabel.affines import apply_affine
  from transforms3d.quaternions import mat2quat, quat2axangle
  from .transform import Transform
label_desc: Use image node_id 7 for calling a global function with example usage: slices2aff(slices) and returns: aff