def _build_self_message(msg, start, end, batch_size, total):
  """Creates a JSON object for batch processing.

  The function builds the message with all the details to be able to process the
  batch data when received. The aim of this message is this very same cloud
  function.

  Args:
    msg: A JSON object representing the message to modify function
    start: An integer representing the start index from the total ocurrences
    end: An integer representing the end index from the total ocurrences
    batch_size: An integer representing the amount of ocurrences in the batch
    total: An integer representing the total amount of ocurrences

  Returns:
    The incoming msg JSON object containing all the input parameters together.
  """
  msg['start_index'] = start
  msg['end_index'] = end
  msg['batch_size'] = batch_size
  msg['total'] = total

  return msg