code: def get_proxy_addr() -> str:
      # The Determined proxying code relies on docker port-mapping container ports to host
      # ports, and it uses the IP address of the agent as a way to address spawned
      # docker containers. This breaks down when running in a docker compose
      # environment, because the address of the agent is not the address of the
      # docker host. As a work-around, force agents to report their IP address as the
      # IP address of the host machine.
      if "darwin" in sys.platform:
          # On macOS, docker runs in a VM and host.docker.internal points to the IP
          # address of this VM.
          return "host.docker.internal"
      else:
          # On non-macOS, host.docker.internal does not exist. Instead, grab the source IP
          # address we would use if we had to talk to the internet. The sed command
          # searches the first line of its input for "src" and prints the first field
          # after that.
          proxy_addr_args = ["ip", "route", "get", "8.8.8.8"]
          pattern = r"s|.* src +(\S+).*|\1|"
          s = subprocess.check_output(proxy_addr_args, encoding="utf-8")
          matches = re.match(pattern, s)
          if matches is not None:
              groups: Sequence[str] = matches.groups()
              if len(groups) != 0:
                  return groups[0]
          return ""
  
imports: import contextlib
  import os
  import pathlib
  import re
  import socket
  import subprocess
  import sys
  import tempfile
  import threading
  import time
  from typing import Any, Callable, Dict, Generator, List, Optional, Sequence, Type
  import appdirs
  import docker
  from determined.common import constants, util
  from determined.deploy.errors import MasterTimeoutExpired
  from determined.deploy.healthcheck import wait_for_master
label_desc: Use image node_id 4 for calling a global function with example usage: get_proxy_addr() and returns: str, str, groups