def _write_to_filepath(content, output):
outdir = os.path.dirname(output)<EOL>if outdir and not os.path.exists(outdir):<EOL><INDENT>os.makedirs(outdir)<EOL><DEDENT>with anytemplate.compat.copen(output, '<STR_LIT:w>') as out:<EOL><INDENT>out.write(content)<EOL><DEDENT>
:param content: Content string to write to
:param output: Output file path