def match_entries(entries, pattern):
    v1, v2 = pattern.find('{'), pattern.find('}')

    if v1 > -1 and v2 > v1:
        variations = pattern[v1+1:v2].split(',')
        variants = [pattern[:v1] + v + pattern[v2+1:] for v in variations]
        matching = []

        for variant in variants:
            matching.extend(fnmatch.filter(entries, variant))

        # remove dupes without changing order
        return list(_deduplicate(matching))

    else:
        matching = fnmatch.filter(entries, pattern)
        matching.sort()
        return matching
A drop-in replacement for fnmatch.filter that supports pattern
dataset/ETHPy150Open brutasse/graphite-api/graphite_api/finders/__init__.py/match_entries