def write_file(filename, contents):
    """Create a file with the specified name and write 'contents' (a
    sequence of strings without line terminators) to it.
    """
    f = open(filename, "w")
    try:
        for line in contents:
            f.write(line + "\n")
    finally:
        f.close()
Create a file with the specified name and write 'contents' (a
    sequence of strings without line terminators) to it.
    
product/gradle-plugin/src/main/python/setuptools/_distutils/file_util.py