def setItem(self,jid,name=None,groups=[]):
        """ Creates/renames contact 'jid' and sets the groups list that it now belongs to."""
        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)
 Creates/renames contact 'jid' and sets the groups list that it now belongs to.
chrome-cordova/gcmServer/xmpp/roster.py