code: def sort_children(self, attribute=None, reverse_order=False):
          sorted_children = []
          if attribute:
              sortable_children = []
              unsortable_children = []
              for child in self.__children:
                  if child.attribute_exists(attribute):
                      sortable_children.append(child)
                  else:
                      unsortable_children.append(child)
              sorted_children = sorted(sortable_children, key=lambda x: getattr(
                  x, attribute).value, reverse=reverse_order or False)
              sorted_children.extend(unsortable_children)
          else:
              sorted_children = sorted(self.children, key=lambda x: (x.name), reverse=reverse_order or False)
          self.__children = sorted_children
          for child in self.__children:
              child.sort_children(attribute, reverse_order)
          return True