code: def _bem_pot_or_field(
      rr, mri_rr, mri_Q, coils, solution, bem_rr, n_jobs, coil_type
  ):
      """Calculate the magnetic field or electric potential forward solution.
  
      The code is very similar between EEG and MEG potentials, so combine them.
      This does the work of "fwd_comp_field" (which wraps to "fwd_bem_field")
      and "fwd_bem_pot_els" in MNE-C.
  
      Parameters
      ----------
      rr : ndarray, shape (n_dipoles, 3)
          3D dipole source positions
      mri_rr : ndarray, shape (n_dipoles, 3)
          3D source positions in MRI coordinates
      mri_Q :
          3x3 head -> MRI transform. I.e., head_mri_t.dot(np.eye(3))
      coils : list of dict, len(sensors)
          List of sensors where each element contains sensor specific information
      solution : ndarray, shape (n_sensors, n_BEM_rr)
          Comes from _bem_specify_coils
      bem_rr : ndarray, shape (n_BEM_vertices, 3)
          3D vertex positions for all surfaces in the BEM
      %(n_jobs)s
      coil_type : str
          'meg' or 'eeg'
  
      Returns
      -------
      B : ndarray, shape (n_dipoles * 3, n_sensors)
          Forward solution for a set of sensors
      """
      # Both MEG and EEG have the inifinite-medium potentials
      # This could be just vectorized, but eats too much memory, so instead we
      # reduce memory by chunking within _do_inf_pots and parallelize, too:
      parallel, p_fun, n_jobs = parallel_func(
          _do_inf_pots, n_jobs, max_jobs=len(rr)
      )
      nas = np.array_split
      B = np.sum(
          parallel(
              p_fun(
                  mri_rr,
                  sr.copy(),
                  np.ascontiguousarray(mri_Q),
                  np.array(sol),
              )  # copy and contig
              for sr, sol in zip(
                  nas(bem_rr, n_jobs), nas(solution.T, n_jobs)
              )
          ),
          axis=0,
      )
      # The copy()s above should make it so the whole objects don't need to be
      # pickled...
  
      # Only MEG coils are sensitive to the primary current distribution.
      if coil_type == "meg":
          # Primary current contribution (can be calc. in coil/dipole coords)
          parallel, p_fun, n_jobs = parallel_func(_do_prim_curr, n_jobs)
          pcc = np.concatenate(
              parallel(p_fun(r, coils) for r in nas(rr, n_jobs)), axis=0
          )
          B += pcc
          B *= _MAG_FACTOR
      return B
  
imports: from copy import deepcopy
  import numpy
  from .._fiff.constants import FIFF
  from ..bem import _import_openmeeg, _make_openmeeg_geometry
  from ..fixes import bincount, jit
  from ..parallel import parallel_func
  from ..surface import _jit_cross, _project_onto_surface
  from ..transforms import apply_trans, invert_transform
  from ..utils import _check_option, _pl, fill_doc, logger, verbose, warn
label_desc: Use image node_id 10 for calling a global function with example usage: _bem_pot_or_field(rr, mri_rr, mri_Q, coils, solution, bem_rr, n_jobs, coil_type) and returns: B