code: def assert_indexing(
      info, picks_by_type, ref_meg=False, all_data=True
  ):
      """Assert our indexing functions work properly."""
      # First that our old and new channel typing functions are equivalent
      _assert_channel_types(info)
      # Next that channel_indices_by_type works
      if not ref_meg:
          idx = channel_indices_by_type(info)
          for key in idx:
              for p in picks_by_type:
                  if key == p[0]:
                      assert_array_equal(idx[key], p[1])
                      break
              else:
                  assert len(idx[key]) == 0
      # Finally, picks_by_type (if relevant)
      if not all_data:
          picks_by_type = [
              p for p in picks_by_type if p[0] in _DATA_CH_TYPES_SPLIT
          ]
      picks_by_type = [
          (p[0], np.array(p[1], int)) for p in picks_by_type
      ]
      actual = _picks_by_type(info, ref_meg=ref_meg)
      assert_object_equal(actual, picks_by_type)
      if not ref_meg and idx["hbo"]:  # our old code had a bug
          with pytest.raises(
              TypeError, match="unexpected keyword argument"
          ):
              _picks_by_type_old(info, ref_meg=ref_meg)
      else:
          old = _picks_by_type_old(info, ref_meg=ref_meg)
          assert_object_equal(old, picks_by_type)
      # test bads
      info = info.copy()
      info["bads"] = [info["chs"][picks_by_type[0][1][0]]["ch_name"]]
      picks_by_type = deepcopy(picks_by_type)
      picks_by_type[0] = (picks_by_type[0][0], picks_by_type[0][1][1:])
      actual = _picks_by_type(info, ref_meg=ref_meg)
      assert_object_equal(actual, picks_by_type)
  
imports: from copy import deepcopy
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from mne import Epochs, channel_indices_by_type, channel_type, create_info, make_ad_hoc_cov, pick_channels, pick_channels_cov, pick_channels_regexp, pick_info, pick_types, pick_types_forward, read_forward_solution, rename_channels
  from mne._fiff.constants import FIFF
  from mne._fiff.pick import _DATA_CH_TYPES_SPLIT, _contains_ch_type, _picks_by_type, _picks_to_idx, get_channel_type_constants
  from mne.channels import make_standard_montage
  from mne.datasets import testing
  from mne.io import RawArray, read_info, read_raw_bti, read_raw_fif, read_raw_kit
  from mne.preprocessing import compute_current_source_density
  from mne.utils import assert_object_equal, catch_logging
label_desc: Use image node_id 6 for calling a global function with example usage: assert_indexing(info, picks_by_type, ref_meg, all_data) without return types