code: def get_public_ip_from_external_service(external_service, timeout=5):
      # type: (str, Optional[int]) -> Optional[str]
      """
      Get the public IP of this machine from an external service.
      Fetching the IP is done via a GET request. The whole content of the request
      should be the IP address
  
      :param external_service: The address of the extrenal service
      :param timeout: The GET request timeout
  
      :return: A string representing the IP of this machine or `None` if getting the IP failed
      """
      # noinspection PyBroadException
      try:
          response = requests.get(external_service, timeout=timeout)
          if not response.ok:
              return None
          ip = response.content.decode("utf8")
          # check that we actually received an IP address
          # noinspection PyBroadException
          try:
              socket.inet_pton(socket.AF_INET, ip)
              return ip
          except Exception:
              socket.inet_pton(socket.AF_INET6, ip)
              return ip
      except Exception:
          return None
  
file_path: clearml/clearml/utilities/networking.py
imports: import requests
  import socket
  import subprocess
  from typing import Optional
label_desc: Use image node_id 3 for calling a global function with example usage: get_public_ip_from_external_service(external_service, timeout) and returns: None, ip, None, ip