<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_last_post_for_model(cr, uid, ids, model_pool):
 """ Given a set of ids and a model pool, return a dict of each object ids with their latest message date as a value. To be called in post-migration scripts :param cr: database cursor :param uid: user id, assumed to be openerp.SUPERUSER_ID :param ids: ids of the model in question to retrieve ids :param model_pool: orm model pool, assumed to be from pool.get() :return: a dict with ids as keys and with dates as values """

    if type(ids) is not list:
        ids = [ids]
    res = {}
    for obj in model_pool.browse(cr, uid, ids):
        message_ids = obj.message_ids
        if message_ids:
            res[obj.id] = sorted(
                message_ids, key=lambda x: x.date, reverse=True)[0].date
        else:
            res[obj.id] = False
    return res