def post_filter(tag):
    """Filter tag containing a post."""

    def only_one_postmsg_class(attr):
        if isinstance(attr, str):
            return attr == 'postmsg'
        return len(attr) == 1 and attr[0] == 'postmsg'

    return tag.name == 'div' and tag.has_attr('class') and\
        only_one_postmsg_class(tag['class'])