def check_message(expr):
    """checks if an expression is a valid message"""
    if expr.has_form('MessageName', 2):
        symbol, tag = expr.get_leaves()
        if symbol.get_name() and tag.get_string_value():
            return True
    return False
