<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def last_post(self):
 """ Returns the latest post associated with the node or one of its descendants. """

        posts = [n.last_post for n in self.children if n.last_post is not None]
        children_last_post = max(posts, key=lambda p: p.created) if posts else None
        if children_last_post and self.obj.last_post_id:
            return max(self.obj.last_post, children_last_post, key=lambda p: p.created)
        return children_last_post or self.obj.last_post