code: def handle_repl(locals):
      
      dump_stacktraces()
      namespace = {
          'dump_stacktraces': dump_stacktraces,
          'sys': sys,
          'os': os,
          'socket': socket,
          'traceback': traceback,
      }
      if locals:
          namespace.update(locals)
      ManholeConsole(namespace).interact()
docs: Dumps stacktraces and runs an interactive prompt (REPL).