def check_outfile(filename, wanted_result):
    """ wanted_result: a string """
    is_ok = True
    handle = open(filename)
    for wanted_line, result_line in zip(wanted_result.splitlines(True), handle
        ):
        if wanted_line != result_line:
            print('Aaaaarg, result is not what we wanted (result:' +
                result_line + ', should be:' + wanted_line.decode() + ')')
            is_ok = False
    handle.close()
    if is_ok:
        print('check ' + filename + ': ok')
    else:
        exit(1)
