def getAttributesString(attributes):
 attributesString = ''
 attributesKeys = attributes.keys()
 attributesKeys.sort(compareAttributeKeyAscending)
 for attributesKey in attributesKeys:
  valueString = str(attributes[attributesKey])
  if ("'" in valueString):
   attributesString += (' %s="%s"' % (attributesKey, valueString))
  else:
   attributesString += (" %s='%s'" % (attributesKey, valueString))
 return attributesString

def getAttributesString ( attributes ) : attributesString = '' attributesKeys = attributes . keys ( ) attributesKeys . sort ( compareAttributeKeyAscending ) for attributesKey in attributesKeys : valueString = str ( attributes [ attributesKey ] ) if ( "'" in valueString ) : attributesString += ( ' %s="%s"' % ( attributesKey , valueString ) ) else : attributesString += ( " %s='%s'" % ( attributesKey , valueString ) ) return attributesString
add the closed xml tag .