code: def test_brain_save_movie(
      tmp_path, renderer, brain_gc, interactive_state
  ):
      """Test saving a movie of a Brain instance."""
      imageio_ffmpeg = pytest.importorskip("imageio_ffmpeg")
      # TODO: Figure out why this fails -- some imageio_ffmpeg error
      if (
          os.getenv("MNE_CI_KIND", "") == "conda"
          and platform.system() == "Linux"
      ):
          pytest.skip("Test broken for unknown reason on conda linux")
  
      brain = _create_testing_brain(
          hemi="lh", time_viewer=False, cortex=["r", "b"]
      )  # custom binarized
      filename = tmp_path / "brain_test.mov"
  
      try:
          # for coverage, we set interactivity
          if interactive_state:
              brain._renderer.plotter.enable()
          else:
              brain._renderer.plotter.disable()
          with pytest.raises(
              TypeError, match="unexpected keyword argument"
          ):
              brain.save_movie(
                  filename,
                  time_dilation=1,
                  tmin=1,
                  tmax=1.1,
                  bad_name="blah",
              )
          assert not filename.is_file()
          tmin = 1
          tmax = 5
          duration = np.floor(tmax - tmin)
          brain.save_movie(
              filename,
              time_dilation=1.0,
              tmin=tmin,
              tmax=tmax,
              interpolation="nearest",
          )
          assert filename.is_file()
          _, nsecs = imageio_ffmpeg.count_frames_and_secs(filename)
          assert_allclose(duration, nsecs, atol=0.2)
  
          os.remove(filename)
      finally:
          brain.close()
  
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 10 for calling a global function with example usage: test_brain_save_movie(tmp_path, renderer, brain_gc, interactive_state) without return types