def _run_exitfuncs():
    """run any registered exit functions

    _exithandlers is traversed in reverse order so functions are executed
    last in, first out.
    """

    exc_info = None
    while _exithandlers:
        func, targs, kargs = _exithandlers.pop()
        try:
            func(*targs, **kargs)
        except __HOLE__:
            exc_info = sys.exc_info()
        except:
            import traceback
            sys.stderr.write("Error in atexit._run_exitfuncs:\n")
            traceback.print_exc()
            exc_info = sys.exc_info()

    if exc_info is not None:
        raise exc_info[0](exc_info[1])
dataset/ETHPy150Open python-zk/kazoo/kazoo/python2atexit.py/_run_exitfuncs