code: def _build_detignore_pathspec(
      root_path: pathlib.Path,
  ) -> "pathspec.PathSpec":
      ignore = list(constants.DEFAULT_DETIGNORE)
      ignore_path = root_path / ".detignore"
      if ignore_path.is_file():
          with ignore_path.open("r") as detignore_file:
              ignore.extend(detignore_file)
  
      # Lazy import to speed up load time.
      # See https://github.com/determined-ai/determined/pull/6590 for details.
      import pathspec
  
      return pathspec.PathSpec.from_lines(
          pathspec.patterns.GitWildMatchPattern, 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 1 for calling a global function with example usage: _build_detignore_pathspec(root_path) and returns: pathspec