'Change role property of a nick in a room.
Typically, roles are temporary (they last only as long as you are in the
room), whereas affiliations are permanent (they last across groupchat
sessions).'

def setRole(self, room, nick, role):

    if (role not in ('moderator', 'participant', 'visitor', 'none')):
        raise TypeError
    query = ET.Element('{http://jabber.org/protocol/muc#admin}query')
    item = ET.Element('item', {'role': role, 'nick': nick})
    query.append(item)
    iq = self.xmpp.makeIqSet(query)
    iq['to'] = room
    result = iq.send()
    if ((result is False) or (result['type'] != 'result')):
        raise ValueError
    return True
