code: def dump_stacktraces():
      
      lines = []
      for thread_id, stack in sys._current_frames().items():  # pylint: disable=W0212
          lines.append("\n######### ProcessID=%s, ThreadID=%s #########" % (
              os.getpid(), thread_id
          ))
          for filename, lineno, name, line in traceback.extract_stack(stack):
              lines.append('File: "%s", line %d, in %s' % (filename, lineno, name))
              if line:
                  lines.append("  %s" % (line.strip()))
      lines.append("#############################################\n\n")
  
      print('\n'.join(lines), file=sys.stderr if _MANHOLE.redirect_stderr else sys.stdout)
docs: Dumps thread ids and tracebacks to stdout.