uses isinstance instead of comparing with type