class_docstr: Collector is the thread that reads and parses lines from stdout or stderr.
  
  It will pass structured data to the logq, and will send a message on doneq when it finishes.
code: def __init__(
      self,
      fd: io.RawIOBase,
      stdtype: str,
      emit_stdout_logs: bool,
      metadata: Dict[str, Any],
      logq: queue.Queue,
      doneq: queue.Queue,
  ) -> None:
      super().__init__()
      self.fd = fd
      self.stdtype = stdtype
      self.metadata = {"stdtype": self.stdtype, **metadata}
      self.logq = logq
      self.doneq = doneq
  
      if not emit_stdout_logs:
          self.dup_io = None
      else:
          self.dup_io = (
              sys.stdout if stdtype == "stdout" else sys.stderr
          )
  
      self.shipper_died = False
  
imports: import datetime
  import io
  import json
  import logging
  import os
  import queue
  import re
  import signal
  import socket
  import ssl
  import subprocess
  import sys
  import threading
  import time
  import traceback
  import urllib.error
  import urllib.request
  from typing import Any, Dict, Iterator, List, NamedTuple, Optional, cast
label_desc: Use image node_id 1 to create a new Collector object from inherited base classes: threading with example: obj = Collector(fd, stdtype, emit_stdout_logs, metadata, logq, doneq)