def collect_key_values(key, data):
    """
    Builds a list of values for all keys matching the given "key" in a nested
    dictionary.

    Args:
        key (object): Dictionary key to search for
        data (dict): Nested data dict

    Returns:
        list: List of values for given key

    """
    values = []
    for k, v in data.items():
        if k == key:
            values.append(v)
            continue
        if isinstance(v, dict):
            values += collect_key_values(key, v)
    return values