code: def make_py_file_filter(filter_names):
      if filter_names is not None:
          with_star = []
          wo_star = set()
          for flt in filter_names:
              flt = flt.split(":")[0]
              if "*" in flt:
                  with_star.append(flt.split("*")[0] + "*")
              else:
                  wo_star.add(flt)
  
      def predicate(filename):
          if filter_names is None:
              return True
          return filename in wo_star or any(
              [
                  fnmatch.fnmatch(
                      escape_for_fnmatch(filename),
                      escape_for_fnmatch(filter_name),
                  )
                  for filter_name in with_star
              ]
          )
  
      return predicate
  
file_path: catboost/library/python/testing/filter/filter.py
imports: import re
  import fnmatch
  import logging
label_desc: Use image node_id 3 for calling a global function with example usage: make_py_file_filter(filter_names) and returns: predicate, unknown, True