docs: def get_relname_and_parent(self, treepos):
          """Return the (relation name, parent ID) tuple that a node is in.
          Return None if this node is not in a relation.
          """
          node = self.dgtree[treepos]
          node_type = get_node_type(node)
          assert node_type in (TreeNodeTypes.relation_node, TreeNodeTypes.leaf_node)
  
          parent_pos = self.get_parent_treepos(treepos)
          if parent_pos is None:  # a root node has no upward relation
              return None, None
          else:
              parent_label = self.get_parent_label(treepos)
              grandparent_pos = self.get_parent_treepos(parent_pos)
  
              if grandparent_pos is None:
                  # a tree with only one EDU/leaf and a 'N' parent but no relation
                  return None, None
              else:
                  grandparent_id = self.get_node_id(grandparent_pos)
                  grandparent_label = self.get_parent_label(parent_pos)
                  reltype = self.get_reltype(grandparent_label)
  
                  if reltype == 'rst':
                      if parent_label == 'N':
                          return 'span', grandparent_id
                      elif parent_label == 'S':
                          cousins_pos = self.get_cousins_treepos(treepos)
                          assert len(cousins_pos) == 1
                          cousin_id = self.get_node_id(cousins_pos[0])
                          return grandparent_label, cousin_id
                  elif reltype == 'multinuc':
                      return grandparent_label, grandparent_id