def _check_student_unhappy(student, project):
    """ Determine whether ``student`` is unhappy either because they are
    unmatched or because they prefer ``project`` to their current matching. """

    return student.matching is None or student.prefers(
        project, student.matching
    )