def asDict(self):
        """ Represent dataitem as simple dictionary mapping of datafield names to their values."""
        ret={}
        for field in self.getTags('field'):
            name=field.getAttr('var')
            typ=field.getType()
            if isinstance(typ,(str,unicode)) and typ[-6:]=='-multi':
                val=[]
                for i in field.getTags('value'): val.append(i.getData())
            else: val=field.getTagData('value')
            ret[name]=val
        if self.getTag('instructions'): ret['instructions']=self.getInstructions()
        return ret
 Represent dataitem as simple dictionary mapping of datafield names to their values.
chrome-cordova/gcmServer/xmpp/protocol.py