code: def add_failure_filtering_cli(parser, pool, *, default=False):
      parser.add_argument(
          "--fail",
          action="append",
          metavar=f'"{{all|{"|".join(sorted(pool))}}},..."',
      )
      parser.add_argument(
          "--no-fail", dest="fail", action="store_const", const=()
      )
  
      def process_args(args, *, argv=None):
          ns = vars(args)
  
          fail = ns.pop("fail")
          try:
              fail = normalize_selection(fail, possible=pool)
          except UnsupportedSelectionError as exc:
              parser.error(
                  f'invalid --fail values: {", ".join(exc.unique)}'
              )
          else:
              if fail is None:
                  fail = default
  
              if fail is True:
  
                  def ignore_exc(_exc):
                      return False
  
              elif fail is False:
  
                  def ignore_exc(_exc):
                      return True
  
              else:
  
                  def ignore_exc(exc):
                      for err in fail:
                          if type(exc) == pool[err]:
                              return False
                      else:
                          return True
  
              args.ignore_exc = ignore_exc
  
      return process_args
  
imports: import argparse
  import contextlib
  import logging
  import os
  import os.path
  import shutil
  import sys
  from .None import fsutil, strutil, iterutil, logging
label_desc: Use image node_id 17 for calling a global function with example usage: add_failure_filtering_cli(parser, pool) and returns: process_args, False, True, True, False