'Creates/renames contact \'jid\' and sets the groups list that it now belongs to.'

def setItem(self, jid, name=None, groups=[]):

    iq = Iq('set', NS_ROSTER)
    query = iq.getTag('query')
    attrs = {'jid': jid}
    if name:
        attrs['name'] = name
    item = query.setTag('item', attrs)
    for group in groups:
        item.addChild(node=Node('group', payload=[group]))
    self._owner.send(iq)
