code: def batch_indices(batch_nb, data_length, batch_size):
      """
      This helper function computes a batch start and end index
      :param batch_nb: the batch number
      :param data_length: the total length of the data being parsed by batches
      :param batch_size: the number of inputs in each batch
      :return: pair of (start, end) indices
      """
      # Batch start and end index
      start = int(batch_nb * batch_size)
      end = int((batch_nb + 1) * batch_size)
  
      # When there are not enough inputs left, we reuse some to complete the
      # batch
      if end > data_length:
          shift = end - data_length
          start -= shift
          end -= shift
  
      return start, end
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from collections import OrderedDict
  import warnings
  import logging
  import os
  import re
  import subprocess
  import numpy
  from six.moves import xrange
label_desc: Use image node_id 1 for calling a global function with example usage: batch_indices(batch_nb, data_length, batch_size) and returns: start,  end