code: def set_post_mortem():
      
      def ipython_post_mortem_debug(shell, etype, evalue, tb,
                 tb_offset=None):
          post_mortem_excepthook(etype, evalue, tb)
      ipython_shell = get_ipython()
      ipython_shell.set_custom_exc((Exception,), ipython_post_mortem_debug)
docs: Enable the post mortem debugging excepthook.