def sort_data(training_data, target_values, unique_classes):

    """
    Returns a dictionary with instances by class labels
    """

    sorted_data = {label : training_data[target_values==label] for label in unique_classes }

    return sorted_data