Something to consider. Perhaps this is better handled by an isinstance check combined with frozen dataclasses and `__post_init__`.