def on(*args, **kwargs):
    """Install the tracestack exception handler as the system exception 
    handler."""

    try:
        ipython_shell = get_ipython()
        handler = ExceptionHandler(*args, **kwargs)

        def _get_ipython_handler(*args, **kwargs):
            def handle_ipython(shell, etype, value, tb, tb_offset=None):
                shell.showtraceback((etype, value, tb), tb_offset=tb_offset)
                handler.handle_error(etype, value, tb)
                return traceback.format_tb(tb)
            return handle_ipython

        ipython_shell.set_custom_exc((Exception,), 
                                     _get_ipython_handler(*args, **kwargs))
    except __HOLE__:
        sys.excepthook = ExceptionHandler(*args, **kwargs)
dataset/ETHPy150Open danrobinson/tracestack/tracestack/debugger.py/on