code: def filter_ns(
      ns,
      name_pattern="*",
      type_pattern="all",
      ignore_case=True,
      show_all=True,
  ):
      """Filter a namespace dictionary by name pattern and item type."""
      pattern = name_pattern.replace("*", ".*").replace("?", ".")
      if ignore_case:
          reg = re.compile(pattern + "$", re.I)
      else:
          reg = re.compile(pattern + "$")
  
      # Check each one matches regex; shouldn't be hidden; of correct type.
      return dict(
          (key, obj)
          for key, obj in iteritems(ns)
          if reg.match(key)
          and show_hidden(key, show_all)
          and is_type(obj, type_pattern)
      )
  
file_path: catboost/contrib/python/ipython/py2/IPython/utils/wildcard.py
imports: import re
  import types
  from IPython.utils.dir2 import dir2
  from .py3compat import iteritems
label_desc: Use image node_id 5 for calling a global function with example usage: filter_ns(ns, name_pattern, type_pattern, ignore_case, show_all) and returns: dict