'Returns true if this object has this type OR has a typeclass
which is an subclass of the given typeclass. This operates on
the actually loaded typeclass (this is important since a
failing typeclass may instead have its default currently
loaded) typeclass - can be a class object or the python path
to such an object to match against.
Args:
typeclass (str or class): A class or the full python path
to the class to check.
exact (bool, optional): Returns true only if the object\'s
type is exactly this typeclass, ignoring parents.
Returns:
is_typeclass (bool): If this typeclass matches the given
typeclass.'

def is_typeclass(self, typeclass, exact=True):

    if isinstance(typeclass, basestring):
        typeclass = ([typeclass] + [('%s.%s' % (prefix, typeclass)) for prefix in settings.TYPECLASS_PATHS])
    else:
        typeclass = [typeclass.path]
    selfpath = self.path
    if exact:
        return (selfpath in typeclass)
    else:
        return any(((hasattr(cls, 'path') and (cls.path in typeclass)) for cls in self.__class__.mro()))
