isinstance() and issubclass()
The isinstance() method is used to determine if an object belongs to a specific class, while the issubclass() method checks if one class is derived from another class or classes, establishing a subclass relationship.
The isinstance() function returns True if the provided object is an instance of the class specified in the classinfo argument, or of any subclass (direct, indirect, or virtual) derived from it.
The issubclass() function returns True if the given class is a subclass (direct, indirect, or virtual) of the class specified in the classinfo argument. It also considers a class to be a subclass of itself.example