code: def has_nrows(
      state,
      incorrect_msg="Your query returned a table with {{n_stu}} row{{'s' if n_stu > 1 else ''}} while it should return a table with {{n_sol}} row{{'s' if n_sol > 1 else ''}}.",
  ):
      
  
      # check that query returned something
      has_result(state)
  
      # assumes that columns cannot be jagged in size
      n_stu = len(next(iter(state.student_result.values())))
      n_sol = len(next(iter(state.solution_result.values())))
  
      if n_stu != n_sol:
          _msg = state.build_message(
              incorrect_msg, fmt_kwargs={"n_stu": n_stu, "n_sol": n_sol}
          )
          state.do_test(_msg)
  
      return state
docs: Test whether the student and solution query results have equal numbers of rows.
      
      Args:
          incorrect_msg: If specified, this overrides the automatically generated feedback message
                         in case the number of rows in the student and solution query don't match.