class HookedModel(db.Model):

    def before_put(self):
        logging.error('before put')

def after_put(self):
    logging.error('after put')

def before_delete(self):
    logging.error('before delete')

def after_delete(self):
    logging.error('after delete')

def put(self):
    return self.put_async().get_result()

def delete(self):
    return self.delete_async().get_result()

def put_async(self):
    return db.put_async(self)

def delete_async(self):
    return db.delete_async(self)
App Engine (Python) Datastore Precall API Hooks