'Update a JID\'s subscription information.
Arguments:
jid          -- The JID to update.
name         -- Optional alias for the JID.
subscription -- The subscription state. May be one of: \'to\',
\'from\', \'both\', \'none\', or \'remove\'.
groups       -- A list of group names.
block        -- Specify if the roster request will block
until a response is received, or a timeout
occurs. Defaults to True.
timeout      -- The length of time (in seconds) to wait
for a response before continuing if blocking
is used. Defaults to self.response_timeout.
callback     -- Optional reference to a stream handler function.
Will be executed when the roster is received.
Implies block=False.'

def update(self, jid, name=None, subscription=None, groups=None, block=True, timeout=None, callback=None):

    if (not groups):
        groups = []
    self[jid]['name'] = name
    self[jid]['groups'] = groups
    self[jid].save()
    if (not self.xmpp.is_component):
        iq = self.xmpp.Iq()
        iq['type'] = 'set'
        iq['roster']['items'] = {jid: {'name': name, 'subscription': subscription, 'groups': groups}}
        return iq.send(block, timeout, callback)
