code: def main(ready: Pattern, waiting: Optional[Pattern] = None):
      master_url = str(os.environ["DET_MASTER"])
      cert = certs.default_load(master_url)
      allocation_id = str(os.environ["DET_ALLOCATION_ID"])
      for line in sys.stdin:
          if ready.match(line):
              post_ready(master_url, cert, allocation_id, "ready")
              return
          if waiting and waiting.match(line):
              post_ready(master_url, cert, allocation_id, "waiting")
  
file_path: determined/master/static/srv/check_ready_logs.py
imports: import argparse
  import os
  import re
  import sys
  import time
  from typing import Optional, Pattern
  from requests.exceptions import RequestException
  from determined.common import api
  from determined.common.api import certs
label_desc: Use image node_id 2 for calling a global function with example usage: main(ready, waiting) without return types