code: def catch_and_print_exceptions(msg=None, return_value=None):
      def decorator(f):
          @wraps(f)
          def wrapper(*args, **kwargs):
              try:
                  return f(*args, **kwargs)
              except Exception as e:  # pylint: disable=broad-except
                  if msg is not None:
                      error(f"{msg}: {str(e)}")
                  else:
                      error(str(e))
                  return return_value
  
          return wrapper
  
      return decorator
  
file_path: keepsake/python/keepsake/console.py
imports: import enum
  from functools import wraps
  import sys
  from ._vendor.colors import color
label_desc: Use image node_id 5 for calling a global function with example usage: catch_and_print_exceptions(msg, return_value) and returns: decorator, wrapper, f, return_value