code: def make_shutil_ignore(root_path: pathlib.Path) -> Callable:
      ignore_spec = _build_detignore_pathspec(root_path)
  
      def _ignore(path: str, names: List[str]) -> Set[str]:
          ignored_names = set()  # type: Set[str]
          for name in names:
              if name == ".detignore":
                  ignored_names.add(name)
                  continue
  
              file_path = pathlib.Path(path) / name
              file_rel_path = file_path.relative_to(root_path)
  
              if (
                  file_path.is_dir()
                  and ignore_spec.match_file(str(file_rel_path) + "/")
              ) or ignore_spec.match_file(str(file_rel_path)):
                  ignored_names.add(name)
  
          return ignored_names
  
      return _ignore
  
file_path: determined/harness/determined/common/detignore.py
imports: import os
  import pathlib
  from typing import TYPE_CHECKING, Callable, Iterable, List, Set
  from determined.common import constants, v1file_utils
  from determined.common.api import bindings
label_desc: Use image node_id 2 for calling a global function with example usage: make_shutil_ignore(root_path) and returns: _ignore, ignored_names