def pm(*args, **kwargs):
    """Post-mortem function that searches the last exception."""

    if hasattr(sys, "last_type"):
        einfo = (sys.last_type, sys.last_value, sys.last_traceback)
        handler = ExceptionHandler(*args, **kwargs)
        try:
            ipython_shell = get_ipython()
            ipython_shell.showtraceback()
            handler.handle_error(*einfo)
        except __HOLE__:
            handler(*einfo)
    else:
        raise ValueError("no last exception")
dataset/ETHPy150Open danrobinson/tracestack/tracestack/debugger.py/pm