code: def has_ncols(
      state,
      incorrect_msg="Your query returned a table with {{n_stu}} column{{'s' if n_stu > 1 else ''}} while it should return a table with {{n_sol}} column{{'s' if n_sol > 1 else ''}}.",
  ):
      
  
      # check that query returned something
      has_result(state)
  
      n_stu = len(state.student_result)
      n_sol = len(state.solution_result)
  
      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 columns.
  
      Args:
          incorrect_msg: If specified, this overrides the automatically generated feedback message
                         in case the number of columns in the student and solution query don't match.
  
      :Example:
  
          Consider the following solution and SCT: ::
  
              # solution
              SELECT artist_id as id, name FROM artists
  
              # sct
              Ex().has_ncols()
  
              # passing submission
              SELECT artist_id as id, name FROM artists
  
              # failing submission (too little columns)
              SELECT artist_id as id FROM artists
  
              # passing submission (two columns, even though not correct ones)
              SELECT artist_id, label FROM artists