code: def _apply_pre_prepare(self, pre_prepare: PrePrepare):
          
  
          reqs = []
          idx = 0
          rejects = []
          invalid_indices = []
          suspicious = False
  
          # 1. apply each request
          for req_key in pre_prepare.reqIdr:
              req = self.requests[req_key].finalised
              try:
                  self.processReqDuringBatch(req,
                                             pre_prepare.ppTime)
              except (InvalidClientMessageException, UnknownIdentifier, SuspiciousPrePrepare) as ex:
                  self.logger.warning('{} encountered exception {} while processing {}, '
                                      'will reject'.format(self, ex, req))
                  rejects.append((req.key, Reject(req.identifier, req.reqId, ex)))
                  invalid_indices.append(idx)
                  if isinstance(ex, SuspiciousPrePrepare):
                      suspicious = True
              finally:
                  reqs.append(req)
              idx += 1
  
          # 2. call callback for the applied batch
          if self.isMaster:
              three_pc_batch = ThreePcBatch.from_pre_prepare(pre_prepare,
                                                             state_root=self.stateRootHash(pre_prepare.ledgerId,
                                                                                           to_str=False),
                                                             txn_root=self.txnRootHash(pre_prepare.ledgerId,
                                                                                       to_str=False),
                                                             primaries=[],
                                                             valid_digests=self.get_valid_req_ids_from_all_requests(
                                                                 reqs, invalid_indices))
              self.node.onBatchCreated(three_pc_batch)
  
          return reqs, invalid_indices, rejects, suspicious
docs: Applies (but not commits) requests of the PrePrepare
          to the ledger and state