human
Complete this python program:
def initHooks(global_exceptions=True, thread_exceptions=True, pass_original=True):
assistant
#Here is the Python program you requested.

    """This method installs exception catching mechanisms. Any exception caught
    will pass through the exception hook, and will be logged to the logger as
    an error. Additionally, a traceback is provided.
    This is very useful for crashing threads and any other bugs, that may not
    be exposed when running as daemon.
    The default exception hook is still considered, if pass_original is True.
    """
    def excepthook(*exception_info):
        try:
            message = ''.join(traceback.format_exception(*exception_info))
            logger.error('Uncaught    exception:    %s', message)
        except:
            pass
        if pass_original:
            sys.__excepthook__(*exception_info)
    if global_exceptions:
        sys.excepthook = excepthook
    if thread_exceptions:
        old_init = threading.Thread.__init__
        def new_init(self, *args, **kwargs):
            old_init(self, *args, **kwargs)
            old_run = self.run
            def new_run(*args, **kwargs):
                try:
                    old_run(*args, **kwargs)
                except (KeyboardInterrupt, SystemExit):
                    raise
                except:
                    excepthook(*sys.exc_info())
            self.run = new_run
        threading.Thread.__init__ = new_init