def xml_add_links(data):
 xml = ''
 chunk = '<link rel="%s" href="%s" title="%s" />'
 links = data.pop(config.LINKS, {})
 ordered_links = OrderedDict(sorted(links.items()))
 for (rel, link) in ordered_links.items():
  if isinstance(link, list):
   xml += ''.join([(chunk % (rel, utils.escape(d['href']), utils.escape(d['title']))) for d in link])
  else:
   xml += ''.join((chunk % (rel, utils.escape(link['href']), link['title'])))
 return xml

def xml_add_links ( data ) : xml = '' chunk = '<link rel="%s" href="%s" title="%s" />' links = data . pop ( config . LINKS , { } ) ordered_links = OrderedDict ( sorted ( links . items ( ) ) ) for ( rel , link ) in ordered_links . items ( ) : if isinstance ( link , list ) : xml += '' . join ( [ ( chunk % ( rel , utils . escape ( d [ 'href' ] ) , utils . escape ( d [ 'title' ] ) ) ) for d in link ] ) else : xml += '' . join ( ( chunk % ( rel , utils . escape ( link [ 'href' ] ) , link [ 'title' ] ) ) ) return xml
returns as many <link> nodes as there are in the datastream .