code: def to_spans(self):
          "Convert the tree to a set of nonterms and spans."
          s = set()
          self._convert_to_spans(self.tree, 1, s)
          return f to_spans(self):
          "Convert the tree to a set of nonterms and spans."
          s = set()
          self._convert_to_spans(self.tree, 1, s)
          return s
docs: Convert the tree to a set of nonterms and spans.