When the type () function provides an object's type, you can also use the isInstance () function to test objects to determine if it is an instance of a particular type or custom class:
>>> print isinstance .__ doc__
IsInstance (Object, Class-or-Type-or-tuple) -> Boolean
RETURN WHETHER An Object IS An Instance of a Class OR of a Subclass Thereof.
With a type as second argument, return WHether That Is The Object's Type.
The Form Using A Tuple, IsInstance (X, (A, B, ...)), IS A Shortcut for
IsInstance (X, A) or isinstance (X, b) or ... (etc.).
>>> IsInstance (42, STR)
0
>>> IsInstance ('a string', int)
0
>>> IsInstance (42, int)
1
>>> IsInstance ('a string', str)
1