def is_subclass(o, bases):
try:<EOL><INDENT>return _issubclass(o, bases)<EOL><DEDENT>except TypeError:<EOL><INDENT>pass<EOL><DEDENT>if not isinstance(o, type):<EOL><INDENT>return False<EOL><DEDENT>if not isinstance(bases, tuple):<EOL><INDENT>return False<EOL><DEDENT>bases = tuple(b for b in bases if isinstance(b, type))<EOL>return _issubclass(o, bases)<EOL>
Similar to the ``issubclass`` builtin, but does not raise a ``TypeError``
if either ``o`` or ``bases`` is not an instance of ``type``.

Example::

    >>> is_subclass(IOError, Exception)
    True
    >>> is_subclass(Exception, None)
    False
    >>> is_subclass(None, Exception)
    False
    >>> is_subclass(IOError, (None, Exception))
    True
    >>> is_subclass(Exception, (None, 42))
    False