def get(self, txid, default = None):

        # the hint we index by for faster lookup
        txid_hint = keys.get_hint(txid)

        # search each level (n, n // 2, n // 4, etc)
        n = self._N
        q = get_q(txid)
        while n >= self.MINIMUM_N:
            connection = self.get_connection(n, q)

            cursor = connection.cursor()
            cursor.execute(self.sql_select + ' where txid_hint = ?', (txid_hint, ))
            for row in cursor.fetchall():
                (vl, txn) = protocol.Txn.parse(row[2])
                if txn.hash == txid:
                    return Transaction(self, row, txn)

            n //= 2

        # maybe another process grew us, and we didn't know? Try again.
        new_n = self.load_n()
        if new_n != self._N:
            self._N = new_n
            return self._get(txid)

        return default


    #def __getitem__(self, name):
    #    'Get a transaction by its txid.'
    #
    #    txn = self.get(name)
    #    if txn is not None:
    #        return txn
    #    raise KeyError(name)

    # Useful? Should it return a blockhain.transaction.Transaction or protocol.Txn?
    #def __iter__(self):
    #    'Iterate over every transaction. There is no meaningful order.'
    #
    #    for connection in self._connections.values():
    #        cursor = connection.cursor()
    #        cursor.execute(self.sql_select)
    #        while True:
    #            rows = cursor.fetchmany()
    #            if not rows: break
    #            for row in rows:
    #                #yield Transaction(self, row)
    #                (vl, txn) = protocol.Txn.parse(row[2])[1]
    #                yield txn
Get a transaction by its txid.
dataset/ETHPy150Open ricmoo/pycoind/pycoind/blockchain/transaction.py/Database.get