code: def test_brain_scraper(
      renderer_interactive_pyvistaqt, brain_gc, tmp_path
  ):
      """Test a simple scraping example."""
      pytest.importorskip("sphinx_gallery")
      from qtpy import API_NAME
  
      if API_NAME.lower() == "pyside6":
          pytest.skip("Error in event loop on PySidie6")
      stc = read_source_estimate(fname_stc, subject="sample")
      size = (600, 400)
      brain = stc.plot(
          subjects_dir=subjects_dir,
          time_viewer=True,
          show_traces=True,
          hemi="split",
          size=size,
          views="lat",
      )
      fnames = [str(tmp_path / f"temp_{ii}.png") for ii in range(2)]
      block_vars = dict(
          image_path_iterator=iter(fnames),
          example_globals=dict(brain=brain),
      )
      block = ("code", "", 1)
      gallery_conf = dict(
          src_dir=str(tmp_path),
          compress_images=[],
          image_srcset=[],
          matplotlib_animations=False,
      )
      scraper = _BrainScraper()
      rst = scraper(block, block_vars, gallery_conf)
      assert brain.plotter is None  # closed
      assert brain._cleaned
      del brain
      fname = Path(fnames[0])
      assert fname.stem in rst
      assert fname.is_file()
      img = image.imread(fname)
      w = img.shape[1]
      w0 = size[0]
      # With matplotlib 3.6 on Linux+conda we get a width of 624,
      # similar tweak in test_brain_init above
      assert np.isclose(w, w0, atol=30) or np.isclose(
          w, w0 * 2, atol=30
      ), f"w ∉ {{{w0}, {2 * w0}}}"
  
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 16 for calling a global function with example usage: test_brain_scraper(renderer_interactive_pyvistaqt, brain_gc, tmp_path) without return types