code: def hmset(self, **kwargs):
          
          if kwargs and not any(kwarg in self._instancehash_fields for kwarg in iterkeys(kwargs)):
              raise ValueError("Only InstanceHashField can be used here.")
  
          indexed = []
  
          # main try block to revert indexes if something fail
          try:
  
              # Set indexes for indexable fields.
              for field_name, value in iteritems(kwargs):
                  field = self.get_field(field_name)
                  if field.indexable:
                      indexed.append(field)
                      field.deindex()
                      field.index(value)
  
              # Call redis (waits for a dict)
              result = self._call_command('hmset', kwargs)
  
              return result
  
          except:
              # We revert indexes previously set if we have an exception, then
              # really raise the error
              for field in indexed:
                  field._rollback_indexes()
              raise
          finally:
              for field in indexed:
                  field._reset_indexes_caches()
docs: This command on the model allow setting many instancehash fields with only
          one redis call. You must pass kwargs with field names as keys, with
          their value.