code: def pick_channels_cov(
      orig,
      include=[],
      exclude="bads",
      ordered=None,
      copy=True,
      *,
      verbose=None,
  ):
      """Pick channels from covariance matrix.
  
      Parameters
      ----------
      orig : Covariance
          A covariance.
      include : list of str, (optional)
          List of channels to include (if empty, include all available).
      exclude : list of str, (optional) | 'bads'
          Channels to exclude (if empty, do not exclude any). Defaults to 'bads'.
      %(ordered)s
      copy : bool
          If True (the default), return a copy of the covariance matrix with the
          modified channels. If False, channels are modified in-place.
  
          .. versionadded:: 0.20.0
      %(verbose)s
  
      Returns
      -------
      res : dict
          Covariance solution restricted to selected channels.
      """
      if copy:
          orig = orig.copy()
          # A little peculiarity of the cov objects is that these two fields
          # should not be copied over when None.
          if "method" in orig and orig["method"] is None:
              del orig["method"]
          if "loglik" in orig and orig["loglik"] is None:
              del orig["loglik"]
  
      exclude = orig["bads"] if exclude == "bads" else exclude
      sel = pick_channels(
          orig["names"],
          include=include,
          exclude=exclude,
          ordered=ordered,
      )
      data = (
          orig["data"][sel][:, sel]
          if not orig["diag"]
          else orig["data"][sel]
      )
      names = [orig["names"][k] for k in sel]
      bads = [name for name in orig["bads"] if name in orig["names"]]
  
      orig["data"] = data
      orig["names"] = names
      orig["bads"] = bads
      orig["dim"] = len(data)
  
      return orig
  
imports: import re
  from copy import deepcopy
  import numpy
  from ..utils import _check_option, _ensure_int, _validate_type, fill_doc, logger, verbose, warn
  from .constants import FIFF
label_desc: Use image node_id 16 for calling a global function with example usage: pick_channels_cov(orig, include, exclude, ordered, copy) and returns: orig