docs: def merge_contiguous(C, node, xpath, namespaces=None):
          """Within a given node, merge elements that are next to each other 
          if they have the same tag and attributes.
          """
          new_node = deepcopy(node)
          elems = XML.xpath(new_node, xpath, namespaces=namespaces)
          elems.reverse()
          for elem in elems:
              nxt = elem.getnext()
              if elem.attrib == {}:
                  XML.replace_with_contents(elem)
              elif (
                  elem.tail in [None, '']
                  and nxt is not None
                  and elem.tag == nxt.tag
                  and elem.attrib == nxt.attrib
              ):
                  # merge nxt with elem
                  # -- append nxt.text to elem last child tail
                  if len(elem.getchildren()) > 0:
                      lastch = elem.getchildren()[-1]
                      lastch.tail = (lastch.tail or '') + (nxt.text or '')
                  else:
                      elem.text = (elem.text or '') + (nxt.text or '')
                  # -- append nxt children to elem children
                  for ch in nxt.getchildren():
                      elem.append(ch)
                  # -- remove nxt
                  XML.remove(nxt, leave_tail=True)
          return new_node