code: def update(self,records,**kw):
          
          # ignore unknown fields
          kw = dict([(k,v) for (k,v) in kw.iteritems() if k in self.fields])
          if isinstance(records,dict):
              records = [ records ]
          # update indices
          for indx in set(self.indices.keys()) & set (kw.keys()):
              for record in records:
                  if record[indx] == kw[indx]:
                      continue
                  _id = record["__id__"]
                  # remove id for the old value
                  old_pos = bisect.bisect(self.indices[indx][record[indx]],_id)-1
                  del self.indices[indx][record[indx]][old_pos]
                  if not self.indices[indx][record[indx]]:
                      del self.indices[indx][record[indx]]
                  # insert new value
                  bisect.insort(self.indices[indx].setdefault(kw[indx],[]),_id)
          for record in records:
              # update record values
              record.update(kw)
              # increment version number
              record["__version__"] += 1
docs: Update one record of a list of records 
          with new keys and values and update indices