Don't compare types with `==`. `type(foo) is SomeType` is better, `isinstance(foo, SomeType)` is best.