code: def get_data(
      batch_ids,
      train_set,
      max_text_length,
      by="user",
      max_num_review=None,
  ):
      batch_reviews, batch_id_reviews, batch_num_reviews = [], [], []
      review_group = (
          train_set.review_text.user_review
          if by == "user"
          else train_set.review_text.item_review
      )
      for idx in batch_ids:
          ids, review_ids = [], []
          for inc, (jdx, review_idx) in enumerate(
              review_group[idx].items()
          ):
              if max_num_review is not None and inc == max_num_review:
                  break
              ids.append(jdx)
              review_ids.append(review_idx)
          batch_id_reviews.append(ids)
          reviews = train_set.review_text.batch_seq(
              review_ids, max_length=max_text_length
          )
          batch_reviews.append(reviews)
          batch_num_reviews.append(len(reviews))
      batch_reviews = pad_sequences(
          batch_reviews, maxlen=max_num_review, padding="post"
      )
      batch_id_reviews = pad_sequences(
          batch_id_reviews, maxlen=max_num_review, padding="post"
      )
      batch_num_reviews = np.array(batch_num_reviews)
      return batch_reviews, batch_id_reviews, batch_num_reviews
  
imports: import numpy
  import tensorflow
  from tensorflow import keras
  from tensorflow.keras import layers, initializers, Input
  from tensorflow.python.keras.preprocessing.sequence import pad_sequences
  from ...utils import get_rng
  from ...utils.init_utils import uniform
label_desc: Use image node_id 1 for calling a global function with example usage: get_data(batch_ids, train_set, max_text_length, by, max_num_review) and returns: batch_reviews,  batch_id_reviews,  batch_num_reviews