def config_gen(dic):
 sio = StringIO()
 print >>sio, '<?xml version="1.0" encoding="UTF-8"?>'
 print >>sio, '<configuration>'
 for (k, v) in dic.iteritems():
  print >>sio, ('<property>\n  <name>%s</name>\n  <value><![CDATA[%s]]></value>\n</property>\n' % (escape(k), (v.replace(']]>', '') if isinstance(v, basestring) else v)))
 print >>sio, '</configuration>'
 sio.flush()
 sio.seek(0)
 return sio.read()

def config_gen ( dic ) : sio = StringIO ( ) print >> sio , '<?xml version="1.0" encoding="UTF-8"?>' print >> sio , '<configuration>' for ( k , v ) in dic . iteritems ( ) : print >> sio , ( '<property>\n  <name>%s</name>\n  <value><![CDATA[%s]]></value>\n</property>\n' % ( escape ( k ) , ( v . replace ( ']]>' , '' ) if isinstance ( v , basestring ) else v ) ) ) print >> sio , '</configuration>' sio . flush ( ) sio . seek ( 0 ) return sio . read ( )
config_gen -> xml for oozie workflow configuration .