def escapedCDATA(data):
 if isinstance(data, unicode):
  data = data.encode('utf-8')
 return data.replace(']]>', ']]]]><![CDATA[>')

def escapedCDATA ( data ) : if isinstance ( data , unicode ) : data = data . encode ( 'utf-8' ) return data . replace ( ']]>' , ']]]]><![CDATA[>' )
escape cdata for inclusion in a document .