code: def _compute_forwards(rr, *, bem, sensors, n_jobs, verbose=None):
      """Compute the MEG and EEG forward solutions."""
      # Split calculation into two steps to save (potentially) a lot of time
      # when e.g. dipole fitting
      solver = bem.get("solver", "mne")
      _check_option("solver", solver, ("mne", "openmeeg"))
      if bem["is_sphere"] or solver == "mne":
          fwd_data = _prep_field_computation(
              rr, sensors=sensors, bem=bem, n_jobs=n_jobs
          )
          Bs = _compute_forwards_meeg(
              rr, sensors=sensors, fwd_data=fwd_data, n_jobs=n_jobs
          )
      else:
          Bs = _compute_forwards_openmeeg(rr, bem=bem, sensors=sensors)
      n_sensors_want = sum(len(s["ch_names"]) for s in sensors.values())
      n_sensors = sum(B.shape[1] for B in Bs.values())
      n_sources = list(Bs.values())[0].shape[0]
      assert (n_sources, n_sensors) == (len(rr) * 3, n_sensors_want)
      return Bs
  
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 23 for calling a global function with example usage: _compute_forwards(rr) and returns: Bs