def write_gpi_template(gpi_filename, output_filename, data_info_list, title=""):
  with open(gpi_filename, "w") as gpi:
    # Finish off the rest of the template
    gpi.write(template)
    if title != "":
      gpi.write('''set title "%s"\n''' % title)
    gpi.write('''set output "%s"\n''' % output_filename)
    gpi.write('''plot ''')
    first_iteration = True
    for i, data_info in enumerate(data_info_list):
      gpi.write('''"%s" index 0:1 title "%s" with steps ls %d''' %
                (data_info.filename, data_info.title, i+1))
      if i != len(data_info_list) - 1:
        gpi.write(", \\\n")
      else:
        gpi.write("\n")
dataset/ETHPy150Open ucb-sts/sts/runtime_stats/generate_graph.py/write_gpi_template/original