'Override for isinstance(instance, cls).'

def __instancecheck__(cls, instance):

    subclass = getattr(instance, '__class__', None)
    if (subclass in cls._abc_cache):
        return True
    subtype = type(instance)
    if (subtype is _InstanceType):
        subtype = subclass
    if ((subtype is subclass) or (subclass is None)):
        if ((cls._abc_negative_cache_version == ABCMeta._abc_invalidation_counter) and (subtype in cls._abc_negative_cache)):
            return False
        return cls.__subclasscheck__(subtype)
    return (cls.__subclasscheck__(subclass) or cls.__subclasscheck__(subtype))
