code: def test_prepare_emptyroom_bads(bads):
      """Test prepare_emptyroom."""
      raw = read_raw_fif(
          raw_fname, allow_maxshield="yes", verbose=False
      )
      names = [name for name in raw.ch_names if "EEG" not in name]
      raw.pick(names)
      raw_er = read_raw_fif(
          erm_fname, allow_maxshield="yes", verbose=False
      )
      raw_er.pick(names)
      assert raw.ch_names == raw_er.ch_names
      assert raw_er.info["dev_head_t"] is None
      assert raw.info["dev_head_t"] is not None
      raw_er.set_montage(None)
  
      if bads == "from_raw":
          raw_bads_orig = ["MEG0113", "MEG2313"]
          raw_er_bads_orig = []
      elif bads == "union":
          raw_bads_orig = ["MEG0113"]
          raw_er_bads_orig = ["MEG2313"]
      elif bads == "keep":
          raw_bads_orig = []
          raw_er_bads_orig = ["MEG0113", "MEG2313"]
  
      raw.info["bads"] = raw_bads_orig
      raw_er.info["bads"] = raw_er_bads_orig
  
      raw_er_prepared = maxwell_filter_prepare_emptyroom(
          raw_er=raw_er, raw=raw, bads=bads
      )
      assert raw_er_prepared.info["bads"] == ["MEG0113", "MEG2313"]
      assert (
          raw_er_prepared.info["dev_head_t"] == raw.info["dev_head_t"]
      )
  
      montage_expected = raw.copy().pick(picks="meg").get_montage()
      assert raw_er_prepared.get_montage() == montage_expected
  
      # Ensure the originals were not modified
      assert raw.info["bads"] == raw_bads_orig
      assert raw_er.info["bads"] == raw_er_bads_orig
      assert raw_er.info["dev_head_t"] is None
      assert raw_er.get_montage() is None
  
imports: import pathlib
  import re
  from contextlib import contextmanager
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from scipy import sparse
  from scipy.special import sph_harm
  import mne
  from mne import compute_raw_covariance, concatenate_raws, pick_info, pick_types
  from mne._fiff.constants import FIFF
  from mne.annotations import _annotations_starts_stops
  from mne.chpi import filter_chpi, read_head_pos
  from mne.datasets import testing
  from mne.forward import _prep_meg_channels, use_coil_def
  from mne.io import BaseRaw, read_info, read_raw_bti, read_raw_ctf, read_raw_fif, read_raw_kit
  from mne.preprocessing import annotate_amplitude, annotate_movement, compute_maxwell_basis, find_bad_channels_maxwell, maxwell_filter, maxwell_filter_prepare_emptyroom
  from mne.preprocessing.maxwell import _bases_complex_to_real, _bases_real_to_complex, _get_n_moments, _prep_mf_coils, _sh_complex_to_real, _sh_negate, _sh_real_to_complex, _sss_basis_basic, _trans_sss_basis
  from mne.rank import _compute_rank_int, _get_rank_sss, compute_rank
  from mne.utils import _record_warnings, assert_meg_snr, buggy_mkl_svd, catch_logging, object_diff, use_log_level
label_desc: Use image node_id 29 for calling a global function with example usage: test_prepare_emptyroom_bads(bads) without return types