code: def _check_info_inv(
      info, forward, data_cov=None, noise_cov=None, verbose=None
  ):
      """Return good channels common to forward model and covariance matrices."""
      from .._fiff.pick import pick_types
  
      # get a list of all channel names:
      fwd_ch_names = forward["info"]["ch_names"]
  
      # handle channels from forward model and info:
      ch_names = _compare_ch_names(
          info["ch_names"], fwd_ch_names, info["bads"]
      )
  
      # make sure that no reference channels are left:
      ref_chs = pick_types(info, meg=False, ref_meg=True)
      ref_chs = [info["ch_names"][ch] for ch in ref_chs]
      ch_names = [ch for ch in ch_names if ch not in ref_chs]
  
      # inform about excluding channels:
      if (
          data_cov is not None
          and set(info["bads"]) != set(data_cov["bads"])
          and (len(set(ch_names).intersection(data_cov["bads"])) > 0)
      ):
          logger.info(
              'info["bads"] and data_cov["bads"] do not match, '
              "excluding bad channels from both."
          )
      if (
          noise_cov is not None
          and set(info["bads"]) != set(noise_cov["bads"])
          and (len(set(ch_names).intersection(noise_cov["bads"])) > 0)
      ):
          logger.info(
              'info["bads"] and noise_cov["bads"] do not match, '
              "excluding bad channels from both."
          )
  
      # handle channels from data cov if data cov is not None
      # Note: data cov is supposed to be None in tf_lcmv
      if data_cov is not None:
          ch_names = _compare_ch_names(
              ch_names, data_cov.ch_names, data_cov["bads"]
          )
  
      # handle channels from noise cov if noise cov available:
      if noise_cov is not None:
          ch_names = _compare_ch_names(
              ch_names, noise_cov.ch_names, noise_cov["bads"]
          )
  
      # inform about excluding any channels apart from bads and reference
      all_bads = info["bads"] + ref_chs
      if data_cov is not None:
          all_bads += data_cov["bads"]
      if noise_cov is not None:
          all_bads += noise_cov["bads"]
      dropped_nonbads = (
          set(info["ch_names"]) - set(ch_names) - set(all_bads)
      )
      if dropped_nonbads:
          logger.info(
              f"Excluding {len(dropped_nonbads)} channel(s) missing from the "
              "provided forward operator and/or covariance matrices"
          )
  
      picks = [
          info["ch_names"].index(k)
          for k in ch_names
          if k in info["ch_names"]
      ]
      return picks
  
imports: import numbers
  import operator
  import os
  import re
  from builtins import input
  from difflib import get_close_matches
  from importlib import import_module
  from pathlib import Path
  import numpy
  from ..defaults import HEAD_SIZE_DEFAULT, _handle_default
  from ..fixes import _compare_version, _median_complex
  from ._logging import _record_warnings, _verbose_safe_false, logger, verbose, warn
label_desc: Use image node_id 30 for calling a global function with example usage: _check_info_inv(info, forward, data_cov, noise_cov, verbose) and returns: picks