@classmethod
    def put(cls, kvs, entity = None):
        
        # prevent malicious overwriting of system attrs
        for k in kvs.keys(): 
            if not k in cls.properties():
                del kvs[k]
                continue
            
            v = cls.__dict__[k]
            
            # convert unicode values to datastore value types
            if isinstance(v, db.IntegerProperty): 
                kvs[k] = int(kvs[k])
            elif isinstance(v, db.FloatProperty):
                kvs[k] = float(kvs[k])
            elif isinstance(v, db.BooleanProperty):
                kvs[k] = True if kvs[k] == 'True' else False
            elif isinstance(v, db.StringProperty) or isinstance(v, db.TextProperty):
                kvs[k] = kvs[k]
            elif isinstance(v, db.DateProperty):
                kvs[k] = datetime.strptime(kvs[k], settings.DATE_FORMAT).date()
            elif isinstance(v, db.LinkProperty):
                kvs[k] = kvs[k] #TODO: verify URL
            elif isinstance(v, db.EmailProperty):
                kvs[k] = kvs[k] #TODO: verify email address
            else:
                raise UnsupportedFieldTypeError(v)
        
        # validate key/value pairs (semantic validation, assume type checking is finished)
        cls.validate(kvs)
        
        try:
            if not entity:
                entity = cls(**kvs)
            else: 
                for k in kvs.keys(): 
                    setattr(entity, k, kvs[k])

            db.put(entity)
        except Exception as e: 
            logging.error(kvs % "Couldn't put entity: %s")
            logging.error(e)
            return None
        
        return entity
    
    # updates existing entity based on id
dataset/ETHPy150Open ibagrak/algae/gae/core/model.py/RESTModel.put/swapped operands of `%`