code: def main():
      requests.packages.urllib3.disable_warnings()
      port = os.environ["NOTEBOOK_PORT"]
      notebook_id = os.environ["DET_TASK_ID"]
      notebook_server = f"https://127.0.0.1:{port}/proxy/{notebook_id}"
      master_url = os.environ["DET_MASTER"]
      cert = certs.default_load(master_url)
      try:
          idle_type = IdleType[os.environ["NOTEBOOK_IDLE_TYPE"].upper()]
      except KeyError:
          logging.warning(
              "unknown idle type '%s', using default value",
              os.environ["NOTEBOOK_IDLE_TYPE"],
          )
          idle_type = IdleType.KERNELS_OR_TERMINALS
  
      wait_for_jupyter(("127.0.0.1", int(port)))
  
      while True:
          try:
              idle = is_idle(notebook_server, idle_type)
              api.put(
                  master_url,
                  f"/api/v1/notebooks/{notebook_id}/report_idle",
                  {"notebook_id": notebook_id, "idle": idle},
                  cert=cert,
              )
          except Exception:
              logging.warning(
                  "ignoring error communicating with master",
                  exc_info=True,
              )
          time.sleep(REPORT_IDLE_INTERVAL)
  
file_path: determined/master/static/srv/check_idle.py
imports: import enum
  import logging
  import os
  import socket
  import time
  import requests
  from determined.common import api
  from determined.common.api import certs
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types