Ok, I see that you've overridden the hash so that `hash(true) == hash(True)` holds. Yet `not isinstance(cond, (bool, NeededSymPyBooleanSuperclass))` would seem a bit better here.