def __cmp__(self, other): if not ICanHasLinkedBranch.providedBy(other): raise AssertionError("Can't compare with: %r" % other) return cmp(self.sort_order, other.sort_order)