code: def build_host_dict(workers):
      """
      Builds a dict to map the set of ports running on each host to
      the hostname.
      :param workers: list(tuple(host, port)) list of worker addresses
      :return: dict(host, set(port))
      """
      hosts = set(map(lambda x: parse_host_port(x), workers))
      hosts_dict = {}
      for host, port in hosts:
          if host not in hosts_dict:
              hosts_dict[host] = set([port])
          else:
              hosts_dict[host].add(port)
  
      return hosts_dict
  
imports: from threading import Lock
  from asyncio import InvalidStateError
  from cuml.internals.import_utils import check_min_dask_version
  from cuml.common import device_of_gpu_matrix
  from dask.distributed import default_client, wait
  import time
  import random
  import dask
  import logging
  import os
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 7 for calling a global function with example usage: build_host_dict(workers) and returns: hosts_dict