def METHOD_NAME(self, hash_bytes: bytes) -> 'BaseTransaction':
    tx = self.get_transaction_from_weakref(hash_bytes)
    if tx is not None:
        return tx
    tx = self._get_transaction_from_db(hash_bytes)
    if not tx:
        raise TransactionDoesNotExist(hash_bytes.hex())
    assert tx._metadata is not None
    assert tx.hash == hash_bytes
    self._save_to_weakref(tx)
    return tx