how about let's use a template for the kml
use jinja2 to generate kml