def reorder_minibatch(minibatch_data, minibatch_label):
    """
    Helper method that sorts the minibatch data and labels so that the samples are 
    sorted in order from longest to shortest. This is makes it more efficient to
    pad different-length samples, according to 
    https://stackoverflow.com/questions/51030782/why-do-we-pack-the-sequences-in-pytorch

    (Taken from Dr. Laurent's batching example)

    Returns a tuple of sorted lists: (data, labels)
    """
    temp = sorted(zip(minibatch_data, minibatch_label),
                  key=lambda x: len(x[0]), reverse=True)
    list1, list2 = map(list, zip(*temp))
    return list1, list2