def write_file(name, text, opts):
fname = path.join(opts.destdir, '<STR_LIT>' % (name, opts.suffix))<EOL>if opts.dryrun:<EOL><INDENT>print('<STR_LIT>' % fname)<EOL>return<EOL><DEDENT>if not opts.force and path.isfile(fname):<EOL><INDENT>print('<STR_LIT>' % fname)<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>' % fname)<EOL>f = open(fname, '<STR_LIT:w>')<EOL>try:<EOL><INDENT>f.write(text)<EOL><DEDENT>finally:<EOL><INDENT>f.close()<EOL><DEDENT><DEDENT>
Write the output file for module/package <name>.