code: def iterate_batch(data, batch_size, shuffle=False):
      if shuffle:
          np.random.shuffle(data)
  
      for start_idx in range(0, len(data), batch_size):
          excerpt = slice(start_idx, start_idx + batch_size)
          batch = data[excerpt]
  
          batch_length = max(
              [len(batch[i][0]) for i in range(len(batch))]
          )
  
          wid_inputs = np.empty(
              [len(batch), batch_length], dtype=np.int64
          )
          cid_inputs = np.empty(
              [len(batch), batch_length, MAX_CHAR_LENGTH],
              dtype=np.int64,
          )
          nid_inputs = np.empty(
              [len(batch), batch_length], dtype=np.int64
          )
          masks = np.zeros([len(batch), batch_length], dtype=np.float32)
          lengths = np.empty(len(batch), dtype=np.int64)
  
          for i, inst in enumerate(batch):
              wids, cid_seqs, nids = inst
  
              inst_size = len(wids)
              lengths[i] = inst_size
              # word ids
              wid_inputs[i, :inst_size] = wids
              wid_inputs[i, inst_size:] = PAD_WORD
              for c, cids in enumerate(cid_seqs):
                  cid_inputs[i, c, : len(cids)] = cids
                  cid_inputs[i, c, len(cids) :] = PAD_CHAR
              cid_inputs[i, inst_size:, :] = PAD_CHAR
              nid_inputs[i, :inst_size] = nids
              nid_inputs[i, inst_size:] = PAD_NER
              masks[i, :inst_size] = 1.0
  
          yield wid_inputs, cid_inputs, nid_inputs, masks, lengths
  
imports: import re
  from collections import defaultdict
  import numpy
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: iterate_batch(data, batch_size, shuffle) without return types