improve write_gml.py