def HandlePyThreads(unused_request, response):
  response.headers.add_header('Content-Type', 'text/plain')
  response.start_response(200)

  frames = sys._current_frames()
  threads = [(t.ident, t) for t in threading.enumerate()]
  thread_names = dict((tid, '(name: %s) ' % t.getName()) for tid, t in threads)

  response.out.write('Python threads:\n\n')
  for thread_id, frame in frames.items():
    response.out.write('--- Thread %d %sstack: ---\n' %
                       (thread_id, thread_names.get(thread_id, '')))
    frame_tuples = []
    while frame:
      filename = frame.f_code.co_filename
      lineno = frame.f_lineno
      line = linecache.getline(filename, lineno)
      frame_tuples.append((filename, lineno, frame.f_code.co_name, line))
      frame = frame.f_back
    frame_tuples.reverse()
    response.out.write(''.join(traceback.format_list(frame_tuples)))
  response.end_response()
Returns a string representing the package version or an empty string if not
dataset/ETHPy150Open google/mysql-tools/pylib/http_handlers.py/HandlePyThreads--crossover with--dataset/ETHPy150Open saltstack/salt/salt/modules/rest_package.py/version