code: def update(self, puts, deletes):
          
          with self._lmdb.begin(write=True, buffers=True) as txn:
              cursor = txn.cursor(self._main_db)
              # Process deletes first, to handle the case of new items replacing
              # old index locations
              for key in deletes:
                  if not cursor.set_key(key.encode()):
                      # value doesn't exist
                      continue
  
                  value = self._deserializer(bytes(cursor.value()))
                  cursor.delete()
  
                  for (index_db, index_key_fn) in self._indexes.values():
                      index_keys = index_key_fn(value)
                      index_cursor = txn.cursor(index_db)
                      for idx_key in index_keys:
                          if index_cursor.set_key(idx_key):
                              index_cursor.delete()
  
              # process all the inserts
              for key, value in puts:
                  packed = self._serializer(value)
  
                  cursor.put(key.encode(), packed, overwrite=True)
  
                  for (index_db, index_key_fn) in self._indexes.values():
                      index_keys = index_key_fn(value)
                      index_cursor = txn.cursor(index_db)
                      for idx_key in index_keys:
                          index_cursor.put(idx_key, key.encode())
  
          self.sync()
docs: Applies the given puts and deletes atomically.
  
          Args:
              puts (:iterable:`tuple`): an iterable of key/value pairs to insert
              deletes (:iterable:str:) an iterable of keys to delete