def METHOD_NAME(list2, name):
    try:
        file = open(name, "w")
    except IOError as message:
        print("failed to open ", name, message)
        sys.exit(1)
    t = '<?xml version="1.0" encoding="us-ascii"?>'
    write_line(file, t)
    write_line(file, "<dwarfbug>")
    for b in list2:
        txt = b.generate_xml()
        write_all_lines(file, txt)
    write_line(file, "</dwarfbug>")
    file.close()