code: def prettify_xml(xml_str):
      
      parsed_xml = parseString(get_string(xml_str))
      pretty_xml = '\n'.join(
          [line for line in parsed_xml.toprettyxml(indent=' ' * 2)
           .split('\n') if line.strip()])
      if not pretty_xml.endswith('\n'):
          pretty_xml += '\n'
      return pretty_xml
docs: returns prettified XML without blank lines
  
      based on http://stackoverflow.com/questions/14479656/
      :param xml_str: the XML to be prettified
      :type xml_str: str
      :return: the prettified XML
      :rtype: str