def write(filename, mesh, file_format=None, **kwargs):
if not file_format:<EOL><INDENT>file_format = _filetype_from_filename(filename)<EOL><DEDENT>for key, value in mesh.cells.items():<EOL><INDENT>if key[:<NUM_LIT:7>] == "<STR_LIT>":<EOL><INDENT>assert value.shape[<NUM_LIT:1>] == int(key[<NUM_LIT:7>:])<EOL><DEDENT>else:<EOL><INDENT>assert value.shape[<NUM_LIT:1>] == num_nodes_per_cell[key]<EOL><DEDENT><DEDENT>try:<EOL><INDENT>interface, args, default_kwargs = _writer_map[file_format]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise KeyError(<EOL>"<STR_LIT>".format(<EOL>file_format, sorted(list(_writer_map.keys()))<EOL>)<EOL>)<EOL><DEDENT>_kwargs = default_kwargs.copy()<EOL>_kwargs.update(kwargs)<EOL>return interface.write(filename, mesh, *args, **_kwargs)<EOL>
Writes mesh together with data to a file.

    :params filename: File to write to.
    :type filename: str

    :params point_data: Named additional point data to write to the file.
    :type point_data: dict