def sanitize_choices(choices, choices_all):
    seen = set()
    others = [x for x in choices_all if x not in choices]
    res = []
    for s in choices:
        if s in list(choices_all) + ['*']:
            if not (s in seen or seen.add(s)):
                res.extend(list(others) if s == '*' else [s])
    return res
Clean up a stringlist configuration attribute: keep only choices
dataset/ETHPy150Open beetbox/beets/beets/plugins.py/sanitize_choices