code: def add_fragment(self, fragment, as_last=True):
          
          if not isinstance(fragment, TextFragment):
              self.log_exc(u"fragment is not an instance of TextFragment", None, True, TypeError)
          self.fragments_tree.add_child(Tree(value=fragment), as_last=as_last)
docs: Add the given text fragment as the first or last child of the root node
          of the text file tree.
  
          :param fragment: the text fragment to be added
          :type  fragment: :class:`~aeneas.textfile.TextFragment`
          :param bool as_last: if ``True`` append fragment, otherwise prepend it