code: def shuffle_dataset(sorted_dataset):
      """
      Given a dataset sorted by len, sorts within each length to make
      chunks of roughly the same size.  Returns all items as a single list.
      """
      dataset = []
      for l in sorted_dataset.keys():
          items = list(sorted_dataset[l])
          random.shuffle(items)
          dataset.extend(items)
      return dataset
  
imports: import collections
  from collections import namedtuple
  import logging
  import json
  import random
  import re
  from typing import List
  from stanza.models.classifiers.utils import WVType
  from stanza.models.common.vocab import PAD, PAD_ID, UNK, UNK_ID
  import stanza.models.constituency.tree_reader
label_desc: Use image node_id 6 for calling a global function with example usage: shuffle_dataset(sorted_dataset) and returns: dataset