def _traverse_bundle(self, txn_hash, target_bundle_hash=None):<EOL>
trytes = (<EOL>GetTrytesCommand(self.adapter)(hashes=[txn_hash])['<STR_LIT>']<EOL>)  <EOL>if not trytes:<EOL><INDENT>raise with_context(<EOL>exc=BadApiResponse(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>),<EOL>context={<EOL>'<STR_LIT>': txn_hash,<EOL>'<STR_LIT>': target_bundle_hash,<EOL>},<EOL>)<EOL><DEDENT>transaction = Transaction.from_tryte_string(trytes[<NUM_LIT:0>])<EOL>if (not target_bundle_hash) and transaction.current_index:<EOL><INDENT>raise with_context(<EOL>exc=BadApiResponse(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>),<EOL>context={<EOL>'<STR_LIT>': transaction,<EOL>'<STR_LIT>': target_bundle_hash,<EOL>},<EOL>)<EOL><DEDENT>if target_bundle_hash:<EOL><INDENT>if target_bundle_hash != transaction.bundle_hash:<EOL><INDENT>return []<EOL><DEDENT><DEDENT>else:<EOL><INDENT>target_bundle_hash = transaction.bundle_hash<EOL><DEDENT>if transaction.current_index == transaction.last_index == <NUM_LIT:0>:<EOL><INDENT>return [transaction]<EOL><DEDENT>return [transaction] + self._traverse_bundle(<EOL>txn_hash=transaction.trunk_transaction_hash,<EOL>target_bundle_hash=target_bundle_hash<EOL>)<EOL>
Recursively traverse the Tangle, collecting transactions until
we hit a new bundle.

This method is (usually) faster than ``findTransactions``, and
it ensures we don't collect transactions from replayed bundles.