code: def _git_ls_ignored_(
      cwd, extended_patterns_file, directory_flag=True
  ):
      cmd = _git_ls_ignored_cmd(extended_patterns_file, directory_flag)
      log.debug("cmd for ls ignored in %s: %s", cwd, cmd)
      try:
          out = subprocess.check_output(
              cmd, cwd=cwd, stderr=subprocess.STDOUT
          )
      except subprocess.CalledProcessError as e:
          if e.returncode not in (128,):
              # 128: not a git repo -> ignore
              log.warning(
                  "error listing ignored files (%i): %s",
                  e.returncode,
                  e.output.decode(),
              )
              if log.getEffectiveLevel() <= logging.DEBUG:
                  log.error(e.stdout)
          raise NoVCS(cwd, (e.returncode, e.stdout)) from None
      else:
          return _parse_git_ls_files(out)
  
imports: import collections
  import logging
  import re
  import os
  import subprocess
  from guild import config
  from guild import file_util
  from guild import util
  from guild.file_util import FileSelectRule
label_desc: Use image node_id 22 for calling a global function with example usage: _git_ls_ignored_(cwd, extended_patterns_file, directory_flag) and returns: _parse_git_ls_files