use `isinstance(x, (A, B))` instead of `isinstance(x, A) or isinstance(x, B)`