code: def threads_list():
          
          results = {}
  
          # pylint: disable=W0212
          try:
              # Extract frames
              frames = sys._current_frames()
  
              # Get the thread ID -> Thread mapping
              names = threading._active.copy()
          except AttributeError:
              # Extraction not available
              return results
  
          # Sort by thread ID
          thread_ids = sorted(frames.keys())
          for thread_id in thread_ids:
              # Get the corresponding stack
              stack = frames[thread_id]
  
              # Try to get the thread name
              try:
                  name = names[thread_id].name
              except KeyError:
                  name = "<unknown>"
  
              trace_lines = []
              frame = stack
              while frame is not None:
                  # Store the line information
                  trace_lines.append(format_frame_info(frame))
  
                  # Previous frame...
                  frame = frame.f_back
  
              # Construct the thread description
              results[thread_id] = {
                  "name": name,
                  "stacktrace": "\n".join(reversed(trace_lines)),
              }
  
          return results
docs: Lists the active threads and their current code line