Create a list of subnets, which are associated with nodes in the current
    route spec (cluster).

    This is needed when later on we set routes, but only want to set routes in
    those route tables, which are associated with a subnet that in turn is
    associated with a cluster node (to avoid having to set the routes in all
    RTs). We can check whether the RT's subnet is in this list here.

    Returns list of subnet IDs.

def make_cluster_node_subnet_list(vpc_info, route_spec):
    """
    Create a list of subnets, which are associated with nodes in the current
    route spec (cluster).

    This is needed when later on we set routes, but only want to set routes in
    those route tables, which are associated with a subnet that in turn is
    associated with a cluster node (to avoid having to set the routes in all
    RTs). We can check whether the RT's subnet is in this list here.

    Returns list of subnet IDs.

    """
    # VPC-info already contains a lookup between the EC2 instances of the VPC
    # and their subnets ('ip_subnet_lookup'). This may also contain some
    # non-cluster nodes, but we can use this to look up the subnet for each IP
    # address of cluster nodes.
    subnets = set()
    for cidr_ignore, hosts in route_spec.items():
        for host_addr in hosts:
            subnet_id = vpc_info['ip_subnet_lookup'].get(host_addr)
            if not subnet_id:
                logging.warning("Did not find subnet associated with "
                                "host address '%s'!" % host_addr)
            else:
                subnets.add(subnet_id)

    return list(subnets)