code: def parse_known_host(parsed_host):
      if parsed_host.netloc.startswith("demoapp."):
          # this is our demo server
          api_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace("demoapp.", "demoapi.", 1)
              + parsed_host.path
          )
          web_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc
              + parsed_host.path
          )
          files_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace("demoapp.", "demofiles.", 1)
              + parsed_host.path
          )
      elif parsed_host.netloc.startswith("app."):
          # this is our application server
          api_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace("app.", "api.", 1)
              + parsed_host.path
          )
          web_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc
              + parsed_host.path
          )
          files_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace("app.", "files.", 1)
              + parsed_host.path
          )
      elif parsed_host.netloc.startswith("demoapi."):
          print(
              "{} is the api server, we need the web server. Replacing 'demoapi.' with 'demoapp.'".format(
                  parsed_host.netloc
              )
          )
          api_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc
              + parsed_host.path
          )
          web_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace("demoapi.", "demoapp.", 1)
              + parsed_host.path
          )
          files_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace("demoapi.", "demofiles.", 1)
              + parsed_host.path
          )
      elif parsed_host.netloc.startswith("api."):
          print(
              "{} is the api server, we need the web server. Replacing 'api.' with 'app.'".format(
                  parsed_host.netloc
              )
          )
          api_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc
              + parsed_host.path
          )
          web_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace("api.", "app.", 1)
              + parsed_host.path
          )
          files_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace("api.", "files.", 1)
              + parsed_host.path
          )
      elif parsed_host.port == 8008:
          print(
              "Port 8008 is the api port. Replacing 8008 with 8080 for Web application"
          )
          api_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc
              + parsed_host.path
          )
          web_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace(":8008", ":8080", 1)
              + parsed_host.path
          )
          files_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace(":8008", ":8081", 1)
              + parsed_host.path
          )
      elif parsed_host.port == 8080:
          print(
              "Port 8080 is the web port. Replacing 8080 with 8008 for API server"
          )
          api_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace(":8080", ":8008", 1)
              + parsed_host.path
          )
          web_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc
              + parsed_host.path
          )
          files_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc.replace(":8080", ":8081", 1)
              + parsed_host.path
          )
      elif parsed_host.port is None:
          print(
              "Web app hosted on standard port using "
              + parsed_host.scheme
              + " protocol."
          )
          print(
              "Assuming files and api ports are unchanged and use the same ("
              + parsed_host.scheme
              + ") protocol"
          )
          api_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc
              + ":8008"
              + parsed_host.path
          )
          web_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc
              + parsed_host.path
          )
          files_host = (
              parsed_host.scheme
              + "://"
              + parsed_host.netloc
              + ":8081"
              + parsed_host.path
          )
      else:
          print("Warning! Could not parse host name")
          api_host = ""
          web_host = ""
          files_host = ""
  
      return api_host, files_host, web_host
  
imports: from __future__ import print_function
  import six
  import argparse
  import os
  from pathlib2 import Path
  from six.moves import input
  from six.moves.urllib.parse import urlparse
  from clearml.backend_api.session import Session
  from clearml.backend_api.session.defs import ENV_HOST
  from clearml.backend_config.defs import LOCAL_CONFIG_FILES, LOCAL_CONFIG_FILE_OVERRIDE_VAR
  from clearml.config import config_obj
  from clearml.utilities.pyhocon import ConfigFactory, ConfigMissingException
label_desc: Use image node_id 3 for calling a global function with example usage: parse_known_host(parsed_host) and returns: api_host,  files_host,  web_host