def METHOD_NAME(
    network: str, provider_uri: str, known_nodes: FleetSensor = None
) -> str:
    """
    Attempts to automatically determine the external IP in the following priority:
    1. Randomly Selected Known Nodes
    2. The Default Teacher URI from RestMiddleware
    3. A centralized IP address service
    If the IP address cannot be determined for any reason UnknownIPAddress is raised.
    """
    rest_host = None
    # primary source
    if known_nodes:
        rest_host = get_external_ip_from_known_nodes(
            known_nodes=known_nodes, provider_uri=provider_uri
        )
    # fallback 1
    if not rest_host:
        rest_host = get_external_ip_from_default_teacher(
            network=network, provider_uri=provider_uri
        )
    # fallback 2
    if not rest_host:
        rest_host = get_external_ip_from_centralized_source()
    # complete failure!
    if not rest_host:
        raise UnknownIPAddress('External IP address detection failed')
    return rest_host