def sort_by_dist(data_to_show):
    sorted_predictions_by_dist = sorted(data_to_show, key=(lambda d: d['dist']), reverse=True)
    for (index, row) in enumerate(sorted_predictions_by_dist):
        row['index'] = index
        sorted_predictions_by_dist[index] = row
    return sorted_predictions_by_dist
def sort_by_dist(data_to_show):
    sorted_predictions_by_dist = sorted(data_to_show, key=(lambda d: d['dist']), reverse=True)
    for (index, row) in enumerate(sorted_predictions_by_dist):
        row['index'] = index
        sorted_predictions_by_dist[index] = row
    return sorted_predictions_by_dist