docs: def encode_sentence(sentence):
      """Encode a single sentence."""
      tree = etree.Element('sentence')
      encode_infons(tree, sentence.infons)
      etree.SubElement(tree, 'offset').text = str(sentence.offset)
      if sentence.text:
          etree.SubElement(tree, 'text').text = sentence.text
      for ann in sentence.annotations:
          tree.append(encode_annotation(ann))
      for rel in sentence.relations:
          tree.append(encode_relation(rel))
      return tree