def _check_resident_unhappy(resident, hospital):
    """Determine whether a resident is unhappy because they are unmatched, or
    they prefer the hospital to their current match."""

    return resident.matching is None or resident.prefers(
        hospital, resident.matching
    )