<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def install_hook(dialog=SimpleExceptionDialog, invoke_old_hook=False, **extra):
 """ install the configured exception hook wrapping the old exception hook don't use it twice :oparam dialog: a different exception dialog class :oparam invoke_old_hook: should we invoke the old exception hook? """

    global _old_hook
    assert _old_hook is None

    def new_hook(etype, eval, trace):
        gobject.idle_add(dialog_handler, dialog, etype, eval, trace, extra)
        if invoke_old_hook:
            _old_hook(etype, eval, trace)

    _old_hook = sys.excepthook
    sys.excepthook = new_hook