'Add a new group (metadata of a sub-document).
Returns False if the group is skipped, True if it has been added.'

def addGroup(self, key, metadata, header=None):

    if (not metadata):
        self.warning(('Skip    empty    group    %s' % key))
        return False
    if key.endswith('[]'):
        key = key[:(-2)]
        if (key in self.__key_counter):
            self.__key_counter[key] += 1
        else:
            self.__key_counter[key] = 1
        key += ('[%u]' % self.__key_counter[key])
    if header:
        metadata.setHeader(header)
    self.__groups.append(key, metadata)
    return True
