import ast


def compare_solutions(solution, filename):
    """
    compare the solution to the solution in *.ans
    :param solution: solution from A*
    :param filename: input file name
    :return: True if it matches
    """
    with open(filename) as f:
        content = ast.literal_eval(f.read())  # parse string repr of the output to a list
        return solution == content