def attributeEscapingDoneOutside(data):
 if isinstance(data, unicode):
  return data.encode('utf-8')
 return data

def attributeEscapingDoneOutside ( data ) : if isinstance ( data , unicode ) : return data . encode ( 'utf-8' ) return data
escape some character or utf-8 byte data for inclusion in the top level of an attribute .