class_docstr: Performs bucketing of elements in a dataset by length.
docstr: Returns iterable of data with elements ordered by bucketed sequence lengths, e.g for batch size = 2 the
  transformation could look like this:
  [1], [3, 3, 3], [1], [4, 4, 4, 4] -> [1], [1], [3, 3, 3], [4, 4, 4, 4]
docstr_tok: ["Returns","iterable","of","data","with","elements","ordered","by","bucketed","sequence","lengths",",","e.g","for","batch","size","=","2","the","transformation","could","look","like","this",":","[","1","]",",","[","3",",","3",",","3","]",",","[","1","]",",","[","4",",","4",",","4",",","4","]","-",">","[","1","]",",","[","1","]",",","[","3",",","3",",","3","]",",","[","4",",","4",",","4",",","4","]"]
code: def __call__(self, data: Iterable) -> Iterable:
      """
      Returns iterable of data with elements ordered by bucketed sequence lengths, e.g for batch size = 2 the
      transformation could look like this:
      [1], [3, 3, 3], [1], [4, 4, 4, 4] -> [1], [1], [3, 3, 3], [4, 4, 4, 4]
      """
      data_iter = iter(data)
      bucket_gen = self._generate_buckets(data_iter)
      return bucket_gen
  
file_path: headliner/headliner/preprocessing/bucket_generator.py
imports: from random import Random
  from typing import Iterable, Callable, Iterator, List
label_desc: Use image node_id 2 for calling the BucketGenerator obj's underlying member method code with example usage: obj.__call__(data) and returns: bucket_gen