code: def write(archive, entries, keymap=None):
      """write entries to klepto db instance 'archive'
  
      Args:
          archive (klepto.archive): archive instance
          entries (iterable): iterable/dict to update the archive with
          keymap (klepto.keymap): keymap used for key encoding
  
      Returns:
          None
  
      Examples:
          >>> write(foo, {x0:y0, x1:y1, ...})
          >>> write(foo, ((x0,y0), (x1,y1), ...))
  
      Notes:
          Within ``entries``, ``xi`` is a tuple of floats, and ``yi`` is a float.
      """
      if isinstance(archive, (str, ("").__class__)):
          archive = read(archive, keymap=keymap)  # assumes default type
      if keymap is not None:  # apply keymap to keys
          entries = {
              keymap(*(k if hasattr(k, "__len__") else (k,))): v
              for k, v in entries.items()
          }
      # archive = read(name, keys=(False if cached else None))
      cached = archive.archive is not archive
      archive.update(
          entries
      )  # XXX: for non-cached, __setitem__ is faster?
      if cached:
          archive.dump()
      return
  
file_path: mystic/mystic/cache/archive.py
imports: from klepto.archives import dict_archive, dir_archive, file_archive, hdf_archive, hdfdir_archive, null_archive, sql_archive, sqltable_archive
label_desc: Use image node_id 2 for calling a global function with example usage: write(archive, entries, keymap) without return types