code: def _ch_neighbor_adjacency(ch_names, neighbors):
      """Compute sensor adjacency matrix.
  
      Parameters
      ----------
      ch_names : list of str
          The channel names.
      neighbors : list of list
          A list of list of channel names. The neighbors to
          which the channels in ch_names are connected with.
          Must be of the same length as ch_names.
  
      Returns
      -------
      ch_adjacency : scipy.sparse.spmatrix
          The adjacency matrix.
      """
      if len(ch_names) != len(neighbors):
          raise ValueError(
              "`ch_names` and `neighbors` must " "have the same length"
          )
      set_neighbors = {c for d in neighbors for c in d}
      rest = set_neighbors - set(ch_names)
      if len(rest) > 0:
          raise ValueError(
              "Some of your neighbors are not present in the "
              "list of channel names"
          )
  
      for neigh in neighbors:
          if not isinstance(neigh, list) and not all(
              isinstance(c, str) for c in neigh
          ):
              raise ValueError(
                  "`neighbors` must be a list of lists of str"
              )
  
      ch_adjacency = np.eye(len(ch_names), dtype=bool)
      for ii, neigbs in enumerate(neighbors):
          ch_adjacency[ii, [ch_names.index(i) for i in neigbs]] = True
      ch_adjacency = csr_matrix(ch_adjacency)
      return ch_adjacency
  
imports: import os.path
  import string
  import sys
  from collections import OrderedDict
  from copy import deepcopy
  from dataclasses import dataclass
  from functools import partial
  from pathlib import Path
  from typing import Union
  import numpy
  from scipy.io import loadmat
  from scipy.sparse import csr_matrix, lil_matrix
  from scipy.spatial import Delaunay
  from scipy.stats import zscore
  from .._fiff.constants import FIFF
  from .._fiff.meas_info import Info, MontageMixin, _merge_info, _rename_comps, _unit2human, create_info
  from .._fiff.pick import _check_excludes_includes, _pick_data_channels, _picks_by_type, _picks_to_idx, _second_rules, channel_indices_by_type, channel_type, pick_channels, pick_info, pick_types
  from .._fiff.proj import setup_proj
  from .._fiff.reference import add_reference_channels, set_eeg_reference
  from .._fiff.tag import _rename_list
  from ..bem import _check_origin
  from ..defaults import HEAD_SIZE_DEFAULT, _handle_default
  from ..utils import _check_dict_keys, _check_fname, _check_option, _check_preload, _get_stim_channel, _on_missing, _validate_type, fill_doc, legacy, logger, verbose, warn
label_desc: Use image node_id 8 for calling a global function with example usage: _ch_neighbor_adjacency(ch_names, neighbors) and returns: ch_adjacency