'Invoked from the user-supplied TensorFlow main function, which should have been launched as a background thread in the start() method
with a multiprocessing.Manager as an argument.  This Manager and a unique queue name must be supplied to this function.'

def next_batch(self, batch_size):

    logging.debug('next_batch()    invoked')
    queue = self.mgr.get_queue(self.qname_in)
    batch = []
    while (len(batch) < batch_size):
        item = queue.get(block=True)
        if (item is None):
            logging.info('next_batch()    got    None')
            queue.task_done()
            self.done_feeding = True
            break
        elif (type(item) is marker.EndPartition):
            logging.info('next_batch()    got    EndPartition')
            queue.task_done()
            if ((not self.train_mode) and (len(batch) > 0)):
                break
        else:
            batch.append(item)
            queue.task_done()
    logging.debug('next_batch()    returning    {0}    items'.format(len(batch)))
    return batch
