code: def leaves(self):
          "Generator that returns the leaves of the tree"
          for child in self.children:
              for x in child.leaves():
                  yield x
          if not self.children:
              yield self leaves(self):
          "Generator that returns the leaves of the tree"
          for child in self.children:
              for x in child.leaves():
                  yield x
          if not self.children:
              yield self
docs: Generator that returns the leaves of the tree