code: def clean_commandline_error_exit(
      allowed_exceptions=(Error, CommandLineError),
      exit_value=errno.ENOENT,
  ):
      """Wraps commands to capture certain exceptions and exit without stacktraces.
  
      This function is intended to wrap all code within main() of Python binaries
      to provide a mechanism for user errors to exit abnormally without causing
      exceptions to be thrown. Any exceptions that are subclasses of those listed
      in `allowed_exceptions` will be caught and the program will quietly exit with
      `exit_value`. Other exceptions are propagated normally.
  
      NOTE: This function should only be used as a context manager and its usage
      should be limited to main().
  
      Args:
        allowed_exceptions: [`tuple of Exception`]. A tuple of Exception classes
          that should not be raised, but instead quietly caused to exit the program.
        exit_value: [`int`]. The value to return upon program exit.
  
      Yields:
        The yield in this function is used to allow the block nested in the "with"
        statement to be executed.
      """
      try:
          yield
      except allowed_exceptions:
          sys.exit(exit_value)
  
file_path: deepvariant/third_party/nucleus/util/errors.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import contextlib
  import errno
  import sys
  from absl import logging
label_desc: Use image node_id 2 for calling a global function with example usage: clean_commandline_error_exit(allowed_exceptions, exit_value) without return types