code: def _get_psf_ctf(
      resmat,
      src,
      idx,
      *,
      func,
      mode,
      n_comp,
      norm,
      return_pca_vars,
      vector=False,
      verbose=None,
  ):
      """Get point-spread (PSFs) or cross-talk (CTFs) functions."""
      # check for consistencies in input parameters
      _check_get_psf_ctf_params(mode, n_comp, return_pca_vars)
  
      # backward compatibility
      if norm is True:
          norm = "max"
  
      # get relevant vertices in source space
      src_orig = src
      _validate_type(
          src_orig, (InverseOperator, Forward, SourceSpaces), "src"
      )
      if not isinstance(src, SourceSpaces):
          src = src["src"]
      verts_all = _vertices_for_get_psf_ctf(idx, src)
      vertno = _get_vertno(src)
      n_verts = sum(len(v) for v in vertno)
      src_type = _get_src_type(src, vertno)
      subject = src._subject
      if vector and src_type == "surface":
          _validate_type(
              src_orig,
              (Forward, InverseOperator),
              "src",
              extra="when creating a vector surface source estimate",
          )
          nn = src_orig["source_nn"]
      else:
          nn = np.repeat(np.eye(3, 3)[np.newaxis], n_verts, 0)
  
      n_r, n_c = resmat.shape
      if ((n_verts != n_r) and (n_r / 3 != n_verts)) or (
          (n_verts != n_c) and (n_c / 3 != n_verts)
      ):
          msg = (
              "Number of vertices (%d) and corresponding dimension of"
              "resolution matrix (%d, %d) do not match"
              % (n_verts, n_r, n_c)
          )
          raise ValueError(msg)
  
      # the following will operate on columns of funcs
      if func == "ctf":
          resmat = resmat.T
          n_r, n_c = n_c, n_r
  
      # Functions and variances per label
      stcs = []
      pca_vars = []
  
      # if 3 orientations per vertex, redefine indices to columns of resolution
      # matrix
      if n_verts != n_c:
          # change indices to three indices per vertex
          for [i, verts] in enumerate(verts_all):
              verts_vec = np.empty(3 * len(verts), dtype=int)
              for [j, v] in enumerate(verts):
                  verts_vec[3 * j : 3 * j + 3] = 3 * verts[
                      j
                  ] + np.array([0, 1, 2])
              verts_all[i] = verts_vec  # use these as indices
  
      for verts in verts_all:
          # get relevant PSFs or CTFs for specified vertices
          if isinstance(verts, int):
              verts = [verts]  # to keep array dimensions
          funcs = resmat[:, verts]
  
          # normalise PSFs/CTFs if requested
          if norm is not None:
              funcs = _normalise_psf_ctf(funcs, norm)
  
          # summarise PSFs/CTFs across vertices if requested
          pca_var = (
              None  # variances computed only if return_pca_vars=True
          )
          if mode is not None:
              funcs, pca_var = _summarise_psf_ctf(
                  funcs, mode, n_comp, return_pca_vars, nn
              )
  
          if not vector:  # if one value per vertex requested
              if (
                  n_verts != n_r
              ):  # if 3 orientations per vertex, combine
                  funcs_int = np.empty([int(n_r / 3), funcs.shape[1]])
                  for i in np.arange(0, n_verts):
                      funcs_vert = funcs[3 * i : 3 * i + 3, :]
                      funcs_int[i, :] = np.sqrt(
                          (funcs_vert**2).sum(axis=0)
                      )
                  funcs = funcs_int
  
          stc = _make_stc(
              funcs,
              vertno,
              src_type,
              tmin=0.0,
              tstep=1.0,
              subject=subject,
              vector=vector,
              source_nn=nn,
          )
          stcs.append(stc)
          pca_vars.append(pca_var)
  
      # if just one list or label specified, simplify output
      if len(stcs) == 1:
          stcs = stc
      if len(pca_vars) == 1:
          pca_vars = pca_var
      if pca_var is not None:
          return stcs, pca_vars
      else:
          return stcs
  
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 2 for calling a global function with example usage: _get_psf_ctf(resmat, src, idx) and returns: stcs,  pca_vars, stcs