code: def _filter(names, spec):
      """Remove names from list of names."""
      if isinstance(spec, str):
          names.remove(spec)
      elif isinstance(spec, list):
          for item in spec:
              names.remove(item)
      elif isinstance(spec, dict):
          for item in spec.values():
              names.remove(item)
      return names
  
imports: import logging
  import re
  from collections import defaultdict
  from copy import deepcopy
  from pathlib import Path
  import numpy
  from ..rcparams import rcParams
  from .base import dict_to_dataset, infer_stan_dtypes, make_attrs, requires
  from .inference_data import InferenceData
label_desc: Use image node_id 2 for calling a global function with example usage: _filter(names, spec) and returns: names