code: def _feed_a_sequence_through_the_queue(
      shuffling_buffer, input_sequence
  ):
      assert shuffling_buffer.size == 0
      assert not shuffling_buffer.can_retrieve()
  
      retrieve_sequence = []
      fro = 0
      while True:
          if shuffling_buffer.can_add():
              to = min(fro + 3, len(input_sequence))
              next_input_chunk = input_sequence[fro:to]
              fro = to
  
              _add_many(shuffling_buffer, next_input_chunk)
  
              if to >= len(input_sequence):
                  shuffling_buffer.finish()
                  break
          for _ in range(2):
              if shuffling_buffer.can_retrieve():
                  retrieve_sequence.extend(
                      _retrieve_many(shuffling_buffer)
                  )
  
      while shuffling_buffer.can_retrieve():
          retrieve_sequence.extend(_retrieve_many(shuffling_buffer))
  
      return retrieve_sequence
  
file_path: petastorm/petastorm/tests/test_shuffling_buffer.py
imports: import numpy
  import pytest
  import six
  from petastorm.reader_impl.shuffling_buffer import NoopShufflingBuffer, RandomShufflingBuffer
  from petastorm.reader_impl.pytorch_shuffling_buffer import BatchedNoopShufflingBuffer, BatchedRandomShufflingBuffer
label_desc: Use image node_id 6 for calling a global function with example usage: _feed_a_sequence_through_the_queue(shuffling_buffer, input_sequence) and returns: retrieve_sequence