code: def _create_testing_brain(
      hemi,
      surf="inflated",
      src="surface",
      size=300,
      n_time=5,
      diverging=False,
      **kwargs,
  ):
      assert src in ("surface", "vector", "mixed", "volume")
      meth = "plot"
      if src in ("surface", "mixed"):
          sample_src = read_source_spaces(src_fname)
          klass = (
              MixedSourceEstimate if src == "mixed" else SourceEstimate
          )
      if src == "vector":
          fwd = read_forward_solution(fname_fwd)
          fwd = pick_types_forward(fwd, meg=True, eeg=False)
          evoked = read_evokeds(fname_evoked, baseline=(None, 0))[0]
          noise_cov = read_cov(fname_cov)
          free = make_inverse_operator(
              evoked.info, fwd, noise_cov, loose=1.0
          )
          stc = apply_inverse(evoked, free, pick_ori="vector")
          return stc.plot(
              subject=subject,
              hemi=hemi,
              size=size,
              subjects_dir=subjects_dir,
              colormap="auto",
              **kwargs,
          )
      if src in ("volume", "mixed"):
          vol_src = setup_volume_source_space(
              subject,
              7.0,
              mri="aseg.mgz",
              volume_label="Left-Cerebellum-Cortex",
              subjects_dir=subjects_dir,
              add_interpolator=False,
          )
          assert len(vol_src) == 1
          assert vol_src[0]["nuse"] == 150
          if src == "mixed":
              sample_src = sample_src + vol_src
          else:
              sample_src = vol_src
              klass = VolSourceEstimate
              meth = "plot_3d"
      assert sample_src.kind == src
  
      # dense version
      rng = np.random.RandomState(0)
      vertices = [s["vertno"] for s in sample_src]
      n_verts = sum(len(v) for v in vertices)
      stc_data = np.zeros(n_verts * n_time)
      stc_size = stc_data.size
      stc_data[
          (rng.rand(stc_size // 20) * stc_size).astype(int)
      ] = rng.rand(stc_data.size // 20)
      stc_data.shape = (n_verts, n_time)
      if diverging:
          stc_data -= 0.5
      stc = klass(stc_data, vertices, 1, 1)
  
      clim = dict(kind="value", lims=[0.1, 0.2, 0.3])
      if diverging:
          clim["pos_lims"] = clim.pop("lims")
  
      brain_data = getattr(stc, meth)(
          subject=subject,
          hemi=hemi,
          surface=surf,
          size=size,
          subjects_dir=subjects_dir,
          colormap="auto",
          clim=clim,
          src=sample_src,
          **kwargs,
      )
      return brain_data
  
imports: import os
  import platform
  from pathlib import Path
  from shutil import copyfile
  import numpy
  import pytest
  from matplotlib import image
  from matplotlib.lines import Line2D
  from numpy.testing import assert_allclose, assert_array_equal
  from mne import Dipole, MixedSourceEstimate, SourceEstimate, VolSourceEstimate, create_info, pick_types_forward, read_cov, read_evokeds, read_forward_solution, read_source_estimate, vertex_to_mni, write_surface
  from mne.channels import make_dig_montage
  from mne.datasets import testing
  from mne.io import read_info
  from mne.label import read_label
  from mne.minimum_norm import apply_inverse, make_inverse_operator
  from mne.source_estimate import _BaseSourceEstimate
  from mne.source_space import read_source_spaces, setup_volume_source_space
  from mne.utils import check_version
  from mne.viz import ui_events
  from mne.viz._brain import Brain, _BrainScraper, _LayeredMesh, _LinkViewer
  from mne.viz._brain.colormap import calculate_lut
  from mne.viz.utils import _get_cmap
label_desc: Use image node_id 20 for calling a global function with example usage: _create_testing_brain(hemi, surf, src, size, n_time, diverging) and returns: brain_data, stc