Preprocess and prepare a dataset

def preprocess_dataset(dataset, labels):
    """ Preprocess and prepare a dataset"""
    start = time.time()
    with mp.Pool() as pool:
        # Each sample is processed in an asynchronous manner.
        dataset = gluon.data.SimpleDataset(list(zip(dataset, labels)))
        lengths = gluon.data.SimpleDataset(pool.map(get_length, dataset))
    end = time.time()
    logging.info('Done! Preprocessing Time={:.2f}s, #Sentences={}'
                 .format(end - start, len(dataset)))
    return dataset, lengths