<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_message_last_post(cr, uid, pool, models):
 """ Given a list of models, set their 'message_last_post' fields to an estimated last post datetime. To be called in post-migration scripts :param cr: database cursor :param uid: user id, assumed to be openerp.SUPERUSER_ID :param pool: orm pool, assumed to be openerp.pooler.get_pool(cr.dbname) :param models: a list of model names for which 'message_last_post' needs \ to be filled :return: """

    if type(models) is not list:
        models = [models]
    for model in models:
        model_pool = pool[model]
        cr.execute(
            "UPDATE {table} "
            "SET message_last_post=(SELECT max(mm.date) "
            "FROM mail_message mm "
            "WHERE mm.model=%s "
            "AND mm.date IS NOT NULL "
            "AND mm.res_id={table}.id)".format(
                table=model_pool._table), (model,)
        )