def _wns_prepare_toast(data, **kwargs):
 root = ET.Element('toast')
 visual = ET.SubElement(root, 'visual')
 binding = ET.SubElement(visual, 'binding')
 binding.attrib['template'] = kwargs.pop('template', 'ToastText01')
 if ('text' in data):
  for (count, item) in enumerate(data['text'], start=1):
   elem = ET.SubElement(binding, 'text')
   elem.text = item
   elem.attrib['id'] = str(count)
 if ('image' in data):
  for (count, item) in enumerate(data['image'], start=1):
   elem = ET.SubElement(binding, 'img')
   elem.attrib['src'] = item
   elem.attrib['id'] = str(count)
 return ET.tostring(root)

def _wns_prepare_toast ( data , ** kwargs ) : root = ET . Element ( 'toast' ) visual = ET . SubElement ( root , 'visual' ) binding = ET . SubElement ( visual , 'binding' ) binding . attrib [ 'template' ] = kwargs . pop ( 'template' , 'ToastText01' ) if ( 'text' in data ) : for ( count , item ) in enumerate ( data [ 'text' ] , start = 1 ) : elem = ET . SubElement ( binding , 'text' ) elem . text = item elem . attrib [ 'id' ] = str ( count ) if ( 'image' in data ) : for ( count , item ) in enumerate ( data [ 'image' ] , start = 1 ) : elem = ET . SubElement ( binding , 'img' ) elem . attrib [ 'src' ] = item elem . attrib [ 'id' ] = str ( count ) return ET . tostring ( root )
creates the xml tree for a toast notification .