<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _txn_is_in_valid_batch(self, txn_id):
 """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. """


        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)))