def read_expected_result(filename):
    """
    Get the expected result from the given file. The expected outcome is the % message following after
    %Expected outcome:
    :param filename: The name of the file
    :return: The expected result.strip().
    :rtype: str
    """
    result = ""
    with open(filename) as f:
        reading = False
        for l in f:
            l = l.strip()
            if l.startswith('%Expected outcome:'):
                reading = True
            elif reading:
                if l.lower().startswith('% error'):
                    return l[len('% error'):].strip()
                elif l.startswith('%'):
                    result = result + "\n" + l[1:]
                else :
                    reading = False
    return result.strip()