Please use elementree module (https://docs.python.org/2/library/xml.etree.elementtree.html) for building XML.

Directly concatenating strings is error prone and can be dangerous (security wise).