def _recommendation(results):
    if not results:
        # No candidates: no recommendation.
        return Recommendation.none

    # Basic distance thresholding.
    min_dist = results[0].distance
    if min_dist < config['match']['strong_rec_thresh'].as_number():
        # Strong recommendation level.
        rec = Recommendation.strong
    elif min_dist <= config['match']['medium_rec_thresh'].as_number():
        # Medium recommendation level.
        rec = Recommendation.medium
    elif len(results) == 1:
        # Only a single candidate.
        rec = Recommendation.low
    elif results[1].distance - min_dist >= \
            config['match']['rec_gap_thresh'].as_number():
        # Gap between first two candidates is large.
        rec = Recommendation.low
    else:
        # No conclusion. Return immediately. Can't be downgraded any further.
        return Recommendation.none

    # Downgrade to the max rec if it is lower than the current rec for an
    # applied penalty.
    keys = set(min_dist.keys())
    if isinstance(results[0], hooks.AlbumMatch):
        for track_dist in min_dist.tracks.values():
            keys.update(track_dist.keys())
    max_rec_view = config['match']['max_rec']
    for key in keys:
        if key in max_rec_view.keys():
            max_rec = max_rec_view[key].as_choice({
                'strong': Recommendation.strong,
                'medium': Recommendation.medium,
                'low': Recommendation.low,
                'none': Recommendation.none,
            })
            rec = min(rec, max_rec)

    return rec
Restores any saved user preference information associated with the
dataset/ETHPy150Open beetbox/beets/beets/autotag/match.py/_recommendation--crossover with--dataset/ETHPy150Open enthought/traitsui/traitsui/qt4/table_editor.py/TableEditor.restore_prefs