code: def append_string(t, string):
      
      node = t.tree
      if string:
          if len(node) == 0:
              if node.text is not None:
                  node.text += string
              else:
                  node.text = string
          else:  # Get last child
              child = list(node)[-1]
              if child.tail is not None:
                  child.tail += string
              else:
                  child.tail = string
docs: Append a string to a node, as text or tail of last child.