class_docstr: Abstract data generator.
class_docstr_tok: ["Abstract","data","generator","."]
code: def _shuffle_and_balance(self, batch_size: int) -> Data:
      data = self.model_data.data
  
      if self.shuffle:
          data = self.model_data.shuffled_data(data)
  
      if self.batch_strategy == BALANCED:
          data = self.model_data.balanced_data(
              data, batch_size, self.shuffle
          )
  
      # do not override self.model_data.data, because we need original data for
      # balancing on the next epoch
      return data
  
imports: import math
  from typing import List, Union, Text, Optional, Any, Tuple, Dict, cast
  import logging
  import scipy.sparse
  import numpy
  from tensorflow.keras.utils import Sequence
  from rasa.utils.tensorflow.constants import SEQUENCE, BALANCED
  from rasa.utils.tensorflow.model_data import RasaModelData, Data, FeatureArray
label_desc: Use image node_id 5 for calling the RasaDataGenerator obj's underlying member method code with example usage: obj._shuffle_and_balance(batch_size) and returns: data