code: def _format_batch_statuses(statuses, batch_ids, tracker):
      
      proto_statuses = []
  
      for batch_id in batch_ids:
          if statuses[batch_id] == \
             client_batch_submit_pb2.ClientBatchStatus.INVALID:
              invalid_txns = tracker.get_invalid_txn_info(batch_id)
              for txn_info in invalid_txns:
                  try:
                      txn_info['transaction_id'] = txn_info.pop('id')
                  except KeyError as e:
                      LOGGER.debug(e)
          else:
              invalid_txns = None
  
          proto_statuses.append(
              client_batch_submit_pb2.ClientBatchStatus(
                  batch_id=batch_id,
                  status=statuses[batch_id],
                  invalid_transactions=invalid_txns))
  
      return proto_statuses
docs: Takes a statuses dict and formats it for transmission with Protobuf and
      ZMQ.
  
      Args:
          statuses (dict of int): Dict with batch ids as the key, status as value
          batch_ids (list of str): The batch ids in their original order
          tracker (BatchTracker): A batch tracker with access to invalid info