code: def _txn_is_in_valid_batch(self, txn_id):
          
  
          batch = self._batches_by_txn_id[txn_id]
  
          # Return whether every transaction in the batch with a
          # transaction result is valid
          return all(
              self._txn_results[sig].is_valid
              for sig in set(self._txn_results).intersection(
                  (txn.header_signature for txn in batch.transactions)))
docs: Returns whether the transaction is in a valid batch.
  
          Args:
              txn_id (str): The transaction header signature.
  
          Returns:
              (bool): True if the txn's batch is valid, False otherwise.