code: def filter(names, pat):
      """Construct a list from those elements of the iterable NAMES that match PAT."""
      result = []
      pat = os.path.normcase(pat)
      match = _compile_pattern(pat)
      if os.path is posixpath:
          # normcase on posix is NOP. Optimize it away from the loop.
          for name in names:
              if match(name):
                  result.append(name)
      else:
          for name in names:
              if match(os.path.normcase(name)):
                  result.append(name)
      return result
  
file_path: cpython/Lib/fnmatch.py
imports: import os
  import posixpath
  import re
  import functools
label_desc: Use image node_id 3 for calling a global function with example usage: filter(names, pat) and returns: result