def _toplevel(cls):
        """Find the top level of the chain we're in.

            For example, if we have:
            C inheriting from B inheriting from A inheriting from ClosureModel
            C._toplevel() will return A.
        """
        superclasses = (
            list(set(ClosureModel.__subclasses__()) &
                 set(cls._meta.get_parent_list()))
        )
        return next(iter(superclasses)) if superclasses else cls
def _toplevel ( cls ) : superclasses = ( list ( set ( ClosureModel . __subclasses__ ( ) ) & set ( cls . _meta . get_parent_list ( ) ) ) ) return next ( iter ( superclasses ) ) if superclasses else cls
Find the top level of the chain we're in.

            For example, if we have:
            C inheriting from B inheriting from A inheriting from ClosureModel
            C._toplevel() will return A.