code: def post_mortem_excepthook(type, value, tb):
      
      clear_post_mortem()
      ipython_shell = get_ipython()
      ipython_shell.showtraceback((type, value, tb))
      p = pdb.Pdb(ipython_shell.colors)
  
      if not type == SyntaxError:
          # wait for stderr to print (stderr.flush does not work in this case)
          time.sleep(0.1)
          _print('*' * 40)
          _print('Entering post mortem debugging...')
          _print('*' * 40)
          #  add ability to move between frames
          p.send_initial_notification = False
          p.reset()
          frame = tb.tb_frame
          prev = frame
          while frame.f_back:
              prev = frame
              frame = frame.f_back
          frame = prev
          # wait for stdout to print
          time.sleep(0.1)
          p.interaction(frame, tb)
docs: For post mortem exception handling, print a banner and enable post
      mortem debugging.