<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def has_equal_value(state, ordered=False, ndigits=None, incorrect_msg=None):
 """Verify if a student and solution query result match up. This function must always be used after 'zooming' in on certain columns or records (check_column, check_row or check_result). ``has_equal_value`` then goes over all columns that are still left in the solution query result, and compares each column with the corresponding column in the student query result. Args: ordered: if set to False, the default, all rows are sorted (according to the first column and the following columns as tie breakers). if set to True, the order of rows in student and solution query have to match. digits: if specified, number of decimals to use when comparing column values. incorrect_msg: if specified, this overrides the automatically generated feedback message in case a column in the student query result does not match a column in the solution query result. :Example: Suppose we are testing the following SELECT statements * solution: ``SELECT artist_id as id, name FROM artists ORDER BY name`` * student : ``SELECT artist_id, name FROM artists`` We can write the following SCTs: :: # passes, as order is not important by default Ex().check_column('name').has_equal_value() # fails, as order is deemed important Ex().check_column('name').has_equal_value(ordered=True) # check_column fails, as id is not in the student query result Ex().check_column('id').has_equal_value() # check_all_columns fails, as id not in the student query result Ex().check_all_columns().has_equal_value() """


    if not hasattr(state, "parent"):
        raise ValueError(
            "You can only use has_equal_value() on the state resulting from check_column, check_row or check_result."
        )

    if incorrect_msg is None:
        incorrect_msg = "Column `{{col}}` seems to be incorrect.{{' Make sure you arranged the rows correctly.' if ordered else ''}}"

    # First of all, check if number of rows correspond
    has_nrows(state)

    if not ordered:
        stu_res, sol_res = sort_rows(state)
    else:
        stu_res = state.student_result
        sol_res = state.solution_result

    for sol_col_name, sol_col_vals in sol_res.items():
        stu_col_vals = stu_res[sol_col_name]
        if ndigits is not None:
            try:
                sol_col_vals = round_seq(sol_col_vals, ndigits)
                stu_col_vals = round_seq(stu_col_vals, ndigits)
            except:
                pass

        if sol_col_vals != stu_col_vals:
            _msg = state.build_message(
                incorrect_msg, fmt_kwargs={"col": sol_col_name, "ordered": ordered}
            )
            state.do_test(_msg)

    return state