import random


def get_imbalanced_data(training_data, img_num_per_cls):
    """Get a list of imbalanced training data, store it into im_data dict."""
    im_data = {}
    for cls_idx, img_id_list in training_data.items():
        random.shuffle(img_id_list)
        img_num = img_num_per_cls[int(cls_idx)]
        im_data[cls_idx] = img_id_list[:img_num]
    return im_data