def filter(fields, subset_file_globs, out_dir):
    subsets = load_subset_definitions(subset_file_globs)
    for subset in subsets:
        subfields = extract_matching_fields(fields, subset['fields'])
        intermediate_files.generate(subfields, os.path.join(out_dir, 'ecs', 'subset', subset['name']), False)
    merged_subset = combine_all_subsets(subsets)
    if merged_subset:
        fields = extract_matching_fields(fields, merged_subset)
    return fields
def filter(fields, subset_file_globs, out_dir):
    subsets = load_subset_definitions(subset_file_globs)
    for subset in subsets:
        subfields = extract_matching_fields(fields, subset['fields'])
        intermediate_files.generate(subfields, os.path.join(out_dir, 'ecs', 'subset', subset['name']), False)
    merged_subset = combine_all_subsets(subsets)
    if merged_subset:
        fields = extract_matching_fields(fields, merged_subset)
    return fields