Replace isinstance override by __instancecheck__ and __subclasscheck__ overrides