you could make use of set operations if they are hashable (and you dont need to have multiple of the same), and random.sample(..., 1) to choose a random one from the set
```py In [1]: from dataclasses import dataclass In [2]: @dataclass ...: class Spell: ...: attributes: set[str] ...: In [3]: spells = [Spell({"a", "b"},), Spell({"c"},)] In [4]: attributes = {"a", "b"}, In [5]: import random In [6]: random.choice([spell for spell in spells if spell.attributes >= attributes]) Out[6]: Spell(attributes={'a', 'b'},) ```