'Iterator returning ProcessTreeNode in sorted order, recursively.'

def __iter__(self):

    if (not self.is_root):
        (yield self)
    if (not self.children_sorted):
        self.children.sort(key=self.__class__.get_weight, reverse=self.sort_reverse)
        self.children_sorted = True
    for child in self.children:
        for n in iter(child):
            (yield n)
