code: def _get_matrix_from_inverse_operator(
      inverse_operator, forward, method="dSPM", lambda2=1.0 / 9.0
  ):
      """Get inverse matrix from an inverse operator.
  
      Currently works only for fixed/loose orientation constraints
      For loose orientation constraint, the CTFs are computed for the normal
      component (pick_ori='normal').
  
      Parameters
      ----------
      inverse_operator : instance of InverseOperator
          The inverse operator.
      forward : instance of Forward
          The forward operator.
      method : 'MNE' | 'dSPM' | 'sLORETA'
          Inverse methods (for apply_inverse).
      lambda2 : float
          The regularization parameter (for apply_inverse).
  
      Returns
      -------
      invmat : array, shape (n_dipoles, n_channels)
          Inverse matrix associated with inverse operator and specified
          parameters.
      """
      # make sure forward and inverse operators match with respect to
      # surface orientation
      _convert_forward_match_inv(forward, inverse_operator)
  
      info_inv = _prepare_info(inverse_operator)
  
      # only use channels that are good for inverse operator and forward sol
      ch_names_inv = info_inv["ch_names"]
      n_chs_inv = len(ch_names_inv)
      bads_inv = inverse_operator["info"]["bads"]
  
      # indices of bad channels
      ch_idx_bads = [ch_names_inv.index(ch) for ch in bads_inv]
  
      # create identity matrix as input for inverse operator
      # set elements to zero for non-selected channels
      id_mat = np.eye(n_chs_inv)
  
      # convert identity matrix to evoked data type (pretending it's an epoch)
      ev_id = EvokedArray(id_mat, info=info_inv, tmin=0.0)
  
      # apply inverse operator to identity matrix in order to get inverse matrix
      # free orientation constraint not possible because apply_inverse would
      # combine components
  
      # check if inverse operator uses fixed source orientations
      is_fixed_inv = _check_fixed_ori(inverse_operator)
  
      # choose pick_ori according to inverse operator
      if is_fixed_inv:
          pick_ori = None
      else:
          pick_ori = "vector"
  
      # columns for bad channels will be zero
      invmat_op = apply_inverse(
          ev_id,
          inverse_operator,
          lambda2=lambda2,
          method=method,
          pick_ori=pick_ori,
      )
  
      # turn source estimate into numpy array
      invmat = invmat_op.data
  
      # remove columns for bad channels
      # take into account it may be 3D array
      invmat = np.delete(invmat, ch_idx_bads, axis=invmat.ndim - 1)
  
      # if 3D array, i.e. multiple values per location (fixed and loose),
      # reshape into 2D array
      if invmat.ndim == 3:
          v0o1 = invmat[0, 1].copy()
          v3o2 = invmat[3, 2].copy()
          shape = invmat.shape
          invmat = invmat.reshape(shape[0] * shape[1], shape[2])
          # make sure that reshaping worked
          assert np.array_equal(v0o1, invmat[1])
          assert np.array_equal(v3o2, invmat[11])
  
      logger.info("Dimension of Inverse Matrix: %s" % str(invmat.shape))
  
      return invmat
  
imports: from copy import deepcopy
  import numpy
  from mne.minimum_norm.inverse import InverseOperator
  from .._fiff.constants import FIFF
  from .._fiff.pick import pick_channels_forward
  from ..evoked import EvokedArray
  from ..forward.forward import Forward, convert_forward_solution
  from ..label import Label
  from ..source_estimate import _get_src_type, _make_stc, _prepare_label_extraction
  from ..source_space._source_space import SourceSpaces, _get_vertno
  from ..utils import _validate_type, logger, verbose
  from .inverse import apply_inverse
label_desc: Use image node_id 11 for calling a global function with example usage: _get_matrix_from_inverse_operator(inverse_operator, forward, method, lambda2) and returns: invmat