<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, entity):
 """ Executes collection's update method based on keyword args. Example:: manager = EntityManager(Product) p = Product() p.name = 'new name' p.description = 'new description' p.price = 300.0 yield manager.update(p) """

        assert isinstance(entity, Entity), "Error: entity must have an instance of Entity"
        return self.__collection.update({'_id': entity._id}, {'$set': entity.as_dict()})