code: def _shuffling_queue(
      shuffling_queue_capacity,
      min_after_dequeue,
      dtypes,
      fields_as_list,
  ):
      """Creates a shuffling queue with enqueue/dequeue pair. Always a single writing thread."""
  
      # Named tuples loose the 'named' part when going via queue
      shuffling_queue = tf.RandomShuffleQueue(
          shuffling_queue_capacity, min_after_dequeue, dtypes
      )
  
      # The following call to .size has a side effect of creating a new node in the TF graph. We are interested
      # in the side effect so we can read the queue size somewhere else, addressing the node by a 'well-known-name'
      shuffling_queue.size(name=RANDOM_SHUFFLING_QUEUE_SIZE)
  
      # We need the queue only for shuffling, so we use only a single enqueuing thread (actually would be happy
      # not to introduce any threads. Not sure if there is such a mechanism in TF)
      queue_runner = tf.train.QueueRunner(
          shuffling_queue, 1 * [shuffling_queue.enqueue(fields_as_list)]
      )
  
      tf.train.add_queue_runner(queue_runner)
  
      # Passed through the queue. We got an ordered list. The order matches the order of fields in unischema
      fields_as_list = shuffling_queue.dequeue()
      return fields_as_list
  
imports: import datetime
  import sys
  import warnings
  from calendar import timegm
  from collections import OrderedDict, namedtuple
  from decimal import Decimal
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 9 for calling a global function with example usage: _shuffling_queue(shuffling_queue_capacity, min_after_dequeue, dtypes, fields_as_list) and returns: fields_as_list