Use isinstance(object, (types)) pattern instead of type(object) == types.Type