function returns true if an objectobjbelongs to the class cname or any class derived from cname here' an exampleclass (object)pass class ( )pass class (object)pass ( ( (instance of 'ainstance of 'binstance of 'ctype(aisinstance( ,aisinstance( ,aisinstance( ,creturns the class object returns true returns trueb derives from returns falsec not derived from similarlythe built-in function issubclass( ,breturns true if the class is subclass of class here' an exampleissubclass( ,aissubclass( ,areturns true returns false subtle problem with type-checking of objects is that programmers often bypass inheritance and simply create objects that mimic the behavior of another object as an exampleconsider these two classesclass foo(object)def spam(self, , )pass class fooproxy(object)def _init_ (self, )self def spam(self, , )return self spam( ,bin this examplefooproxy is functionally identical to foo it implements the same methodsand it even uses foo underneath the covers yetin the type systemfooproxy is different than foo for examplef foo( fooproxy(fisinstance(gfoocreate foo create fooproxy returns false if program has been written to explicitly check for foo using isinstance()then it certainly won' work with fooproxy object howeverthis degree of strictness is often not exactly what you want insteadit might make more sense to assert that an object can simply be used as foo because it has the same interface to do thisit is possible to define an object that redefines the behavior of isinstance(and issubclass(for the purpose of grouping objects together and type-checking here is an exampleclass iclass(object)def _init_ (self)self implementors set(def register(self, )self implementors add(cdef _instancecheck_ (self, )return self _subclasscheck_ (type( ) lib fl ff