'Add a new item, either to this group or to a subgroup
@param item: the item'

def add(self, item):

    if self._aggregates:
        self._aggregates = {}
    key = self.key
    if key:
        raw = item.get('_row')
        if (raw is None):
            value = item.get(key)
        else:
            try:
                value = raw.get(key)
            except (AttributeError, TypeError):
                value = item.get(key)
        if (type(value) is list):
            add_to_group = self.add_to_group
            for v in value:
                add_to_group(key, v, item)
        else:
            self.add_to_group(key, value, item)
    else:
        self.items.append(item)
