code: def cmp_branch(self, node1, node2):
          
          # note reverse
          return cmp(getattr(self[node2], "branch", None), \
                     getattr(self[node1], "branch", None))
docs: comparison of **node objects** based on the ``"branch"`` attribute of 
          their **topological nodes**.