def dump_cml(f, molecules):
if isinstance(f, str):<EOL><INDENT>f = open(f, "<STR_LIT:w>")<EOL>close = True<EOL><DEDENT>else:<EOL><INDENT>close = False<EOL><DEDENT>f.write("<STR_LIT>")<EOL>f.write("<STR_LIT>")<EOL>for molecule in molecules:<EOL><INDENT>_dump_cml_molecule(f, molecule)<EOL><DEDENT>f.write("<STR_LIT>")<EOL>if close:<EOL><INDENT>f.close()<EOL><DEDENT>
Write a list of molecules to a CML file

       Arguments:
        | ``f``  --  a filename of a CML file or a file-like object
        | ``molecules``  --  a list of molecule objects.