class_docstr: Abstract data generator.
class_docstr_tok: ["Abstract","data","generator","."]
docstr: Slices model data into batch using given start and end value.
  
  Args:
      data: The data to prepare.
      start: The start index of the batch
      end: The end index of the batch
      tuple_sizes: In case the feature is not present we propagate the batch with
        None. Tuple sizes contains the number of how many None values to add for
        what kind of feature.
  
  Returns:
      The features of the batch.
docstr_tok: ["Slices","model","data","into","batch","using","given","start","and","end","value",".","Args",":","data",":","The","data","to","prepare",".","start",":","The","start","index","of","the","batch","end",":","The","end","index","of","the","batch","tuple_sizes",":","In","case","the","feature","is","not","present","we","propagate","the","batch","with","None",".","Tuple","sizes","contains","the","number","of","how","many","None","values","to","add","for","what","kind","of","feature",".","Returns",":","The","features","of","the","batch","."]
code: def prepare_batch(
      data: Data,
      start: Optional[int] = None,
      end: Optional[int] = None,
      tuple_sizes: Optional[Dict[Text, int]] = None,
  ) -> Tuple[Optional[np.ndarray], ...]:
      """Slices model data into batch using given start and end value.
  
      Args:
          data: The data to prepare.
          start: The start index of the batch
          end: The end index of the batch
          tuple_sizes: In case the feature is not present we propagate the batch with
            None. Tuple sizes contains the number of how many None values to add for
            what kind of feature.
  
      Returns:
          The features of the batch.
      """
      batch_data = []
  
      for key, attribute_data in data.items():
          for sub_key, f_data in attribute_data.items():
              # add None for not present values during processing
              if not f_data:
                  if tuple_sizes:
                      batch_data += [None] * tuple_sizes[key]
                  else:
                      batch_data.append(None)
                  continue
  
              for v in f_data:
                  if start is not None and end is not None:
                      _data = v[start:end]
                  elif start is not None:
                      _data = v[start:]
                  elif end is not None:
                      _data = v[:end]
                  else:
                      _data = v[:]
  
                  if cast(FeatureArray, _data).is_sparse:
                      batch_data.extend(
                          RasaDataGenerator._scipy_matrix_to_values(
                              _data
                          )
                      )
                  else:
                      batch_data.append(
                          RasaDataGenerator._pad_dense_data(_data)
                      )
  
      # len of batch_data is equal to the number of keys in model data
      return tuple(batch_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 6 for calling the RasaDataGenerator obj's underlying member method code with example usage: obj.prepare_batch(data, start, end, tuple_sizes) and returns: tuple