def _select_class_label(top_k_rows, label_index):
    """ Gets the class label based on majority voting

    :param top_k_rows: a list in the form of [(dist, row),...]
    :param label_index: the index in the rows where the label is located
    :return: the most common label
    """
    labels = []
    for tuple in top_k_rows:
        dist, row = tuple
        labels.append(row[label_index])
    return max(set(labels), key=labels.count)