add attributes to group nodes, as well as in-edges from other
        groups. a group's ``type`` attribute tells us whether the group
        node represents a span (of RST segments or other groups) OR
        a multinuc(ular) relation (i.e. it dominates several RST nucleii).

        a group's ``relname`` gives us the name of the relation between
        the group node and the group's parent node.

        Parameters
        ----------
        group : ??? etree Element

def __add_group(self, group):
        """
        add attributes to group nodes, as well as in-edges from other
        groups. a group's ``type`` attribute tells us whether the group
        node represents a span (of RST segments or other groups) OR
        a multinuc(ular) relation (i.e. it dominates several RST nucleii).

        a group's ``relname`` gives us the name of the relation between
        the group node and the group's parent node.

        Parameters
        ----------
        group : ??? etree Element
        """
        group_id = self.ns+':'+group.attrib['id']
        group_type = group.attrib['type']  # 'span' or 'multinuc'
        group_layers = {self.ns, self.ns+':group'}
        segment_type, parent_segment_type = self.__get_segment_types(group)

        group_attrs = \
            {self.ns+':group_type': group_type,
             'label': '{0}:group:{1}:{2}'.format(self.ns, group_type,
                                                 group.attrib['id'])}

        if group_id not in self:  # group node doesn't exist, yet
            group_attrs[self.ns+':segment_type'] = segment_type
            self.add_node(group_id, layers=group_layers,
                          attr_dict=group_attrs)
        else: # group node does already exist
            if segment_type != 'span':  # if it is an RST relation
                group_attrs[self.ns+':segment_type'] = segment_type
            else: # segment_type == 'span'
                # if the group already has a segment type, we won't overwrite
                # it, since 'span' is not very informative
                if not self.ns+':segment_type' in self.node[group_id]:
                    group_attrs[self.ns+':segment_type'] = segment_type
            self.node[group_id].update(group_attrs,
                                       layers={self.ns, self.ns+':group'})

        if 'parent' not in group.attrib:  # mark group as RST root node
            # each discourse docgraphs has a default root node, but we will
            # overwrite it here
            old_root_id = self.root
            self.root = group_id
            # workaround for #141: the layers attribute is append-only,
            # but here we're updating it as a part of the attribute dict
            #
            # root segment type: always span
            root_attrs = {'layers': {self.ns, self.ns+':root'},
                          self.ns+':segment_type': 'span'}
            self.node[group_id].update(root_attrs)
            # copy metadata from old root node
            self.node[group_id]['metadata'] = self.node[old_root_id]['metadata']
            # finally, remove the old root node
            self.remove_node(old_root_id)
        else:  # the group node is dominated by another group or segment
            self.__add_parent_relation(group, group_id, segment_type,
                                       parent_segment_type)