def aggregate_values_from_key(host_state, key_name):
    """Returns a set of values based on a metadata key for a specific host."""
    aggrlist = host_state.aggregates
    aggregate_vals = set()
    for aggr in aggrlist:
        if key_name in aggr.metadata:
            aggregate_vals.add(aggr.metadata[key_name])
    return aggregate_vals