'Return a dictionary mapping group names to JIDs.'

def groups(self):

    result = {}
    for jid in self._jids:
        groups = self._jids[jid]['groups']
        if (not groups):
            if ('' not in result):
                result[''] = []
            result[''].append(jid)
        for group in groups:
            if (group not in result):
                result[group] = []
            result[group].append(jid)
    return result
