code: def _find_host_port(
      ports: Dict[str, Any], container_port: int
  ) -> str:
      """Find host port from container port mappings.
  
      `ports` is a nested dictionary of the following structure:
  
      {
          '8500/tcp': [
              {'HostIp': '0.0.0.0', 'HostPort': '32769'},
              {'HostIp': '::', 'HostPort': '32770'},
          ],
          '8501/tcp': [
              {'HostIp': '0.0.0.0', 'HostPort': '32768'},
              {'HostIp': '::', 'HostPort': '32771'},
          ],
      }
  
      Args:
        ports: Dictionary of docker container port mapping.
        container_port: Corresponding container port you're looking for.
  
      Returns:
        A found host port.
  
      Raises:
        ValueError: No corresponding host port was found.
      """
      mappings = ports.get("{}/tcp".format(container_port), [])
      for mapping in mappings:
          if mapping["HostIp"] == "0.0.0.0":
              return mapping["HostPort"]
      else:
          raise ValueError(
              "No HostPort found for ContainerPort={} (all port mappings: {})".format(
                  container_port, ports
              )
          )
  
imports: import os
  import time
  from typing import Any, Dict, Optional
  from absl import logging
  import docker
  from docker import errors
  from tfx.components.infra_validator import error_types
  from tfx.components.infra_validator import serving_bins
  from tfx.components.infra_validator.model_server_runners import base_runner
  from tfx.proto import infra_validator_pb2
label_desc: Use image node_id 2 for calling a global function with example usage: _find_host_port(ports, container_port) and returns: mapping