code: def write(filename, mesh, file_format=None, **kwargs):
      
      if not file_format:
          # deduce file format from extension
          file_format = _filetype_from_filename(filename)
  
      # check cells for sanity
      for key, value in mesh.cells.items():
          if key[:7] == "polygon":
              assert value.shape[1] == int(key[7:])
          else:
              assert value.shape[1] == num_nodes_per_cell[key]
  
      try:
          interface, args, default_kwargs = _writer_map[file_format]
      except KeyError:
          raise KeyError(
              "Unknown format '{}'. Pick one of {}".format(
                  file_format, sorted(list(_writer_map.keys()))
              )
          )
  
      # Build kwargs
      _kwargs = default_kwargs.copy()
      _kwargs.update(kwargs)
  
      # Write
      return interface.write(filename, mesh, *args, **_kwargs)
docs: 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