def write_file(fobj, opts=None, data=None, eopts=None):
lines = []<EOL>lines.append("<STR_LIT>")<EOL>if opts:<EOL><INDENT>lines.append("<STR_LIT>" + "<STR_LIT:U+0020>".join(opts))<EOL><DEDENT>if eopts:<EOL><INDENT>lines.append("<STR_LIT>" + eopts)<EOL><DEDENT>if not data:<EOL><INDENT>data = [[<NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:1>]]<EOL><DEDENT>for row in data:<EOL><INDENT>lines.append("<STR_LIT:U+0020>".join([str(item) for item in row]))<EOL><DEDENT>lines = [item + "<STR_LIT:\n>" for item in lines]<EOL>fobj.writelines(lines)<EOL>
Write a sample Touchstone file.