code: def git_ignore_check(expect_fail, stdout_buffer, stderr_buffer):
      try:
          yield None
      except CommandError as e:
          e.stdout = (
              "".join(stdout_buffer)
              if stdout_buffer
              else (e.stdout or "")
          )
          e.stderr = (
              "".join(stderr_buffer)
              if stderr_buffer
              else (e.stderr or "")
          )
          ignore_exception = _get_git_ignore_exception(e)
          if ignore_exception:
              raise ignore_exception
          lgr.log(5 if expect_fail else 11, str(e))
          raise
  
imports: import logging
  import re
  import threading
  import time
  from contextlib import contextmanager
  from locale import getpreferredencoding
  from os import environ
  from os.path import lexists
  from typing import Optional
  from weakref import finalize, WeakValueDictionary
  from datalad.cmd import GitWitlessRunner, StdOutErrCapture
  from datalad.config import ConfigManager
  from datalad.dataset.repo import PathBasedFlyweight, RepoInterface, path_based_str_repr
  from datalad.runner.nonasyncrunner import STDERR_FILENO, STDOUT_FILENO
  from datalad.runner.protocol import GeneratorMixIn
  from datalad.runner.utils import AssemblingDecoderMixIn, LineSplitter
  from datalad.support.exceptions import CommandError, GitIgnoreError, InvalidGitRepositoryError, PathKnownToRepositoryError
  from datalad.utils import ensure_list, lock_if_required, Path
label_desc: Use image node_id 1 for calling a global function with example usage: git_ignore_check(expect_fail, stdout_buffer, stderr_buffer) without return types