code: def list_all_files(paths, filter_=None, recursive=True):
      """
      Need this function as Py2 doesn't provide any useful `glob` implementation.
      :param paths: the directories to look into.
      :param filter_: None, or a predicate function returning True iff the file should be listed.
      :param recursive: True if files should be listed recursively in sub folders.
      :return: the listed files
      """
      filter_ = filter_ or (lambda _: True)
      all_files = []
      paths = paths if isinstance(paths, list) else [paths]
      for path in paths:
          if os.path.isdir(path):
              for root_dir, sub_dirs, files in os.walk(path):
                  if not recursive and root_dir != path:
                      break
                  for name in files:
                      full_path = os.path.join(root_dir, name)
                      if filter_(full_path):
                          all_files.append(full_path)
          elif os.path.isfile(path):
              if filter_(path):
                  all_files.append(path)
      return all_files
  
file_path: h2o-3/h2o-py/tests/_utils.py
imports: import fnmatch
  import importlib
  import os
  import re
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: list_all_files(paths, filter_, recursive) and returns: all_files