Helper method that reconstructs a transaction dict that was returned
        from the database. It checks what asset_id to retrieve, retrieves the
        asset from the asset table and reconstructs the transaction.

        Args:
            bigchain (:class:`~bigchaindb.tendermint.BigchainDB`): An instance
                of BigchainDB used to perform database queries.
            tx_dict_list (:list:`dict` or :obj:`dict`): The transaction dict or
                list of transaction dict as returned from the database.

        Returns:
            :class:`~Transaction`

def from_db(cls, bigchain, tx_dict_list):
        """Helper method that reconstructs a transaction dict that was returned
        from the database. It checks what asset_id to retrieve, retrieves the
        asset from the asset table and reconstructs the transaction.

        Args:
            bigchain (:class:`~bigchaindb.tendermint.BigchainDB`): An instance
                of BigchainDB used to perform database queries.
            tx_dict_list (:list:`dict` or :obj:`dict`): The transaction dict or
                list of transaction dict as returned from the database.

        Returns:
            :class:`~Transaction`

        """
        return_list = True
        if isinstance(tx_dict_list, dict):
            tx_dict_list = [tx_dict_list]
            return_list = False

        tx_map = {}
        tx_ids = []
        for tx in tx_dict_list:
            tx.update({'metadata': None})
            tx_map[tx['id']] = tx
            tx_ids.append(tx['id'])

        assets = list(bigchain.get_assets(tx_ids))
        for asset in assets:
            if asset is not None:
                tx = tx_map[asset['id']]
                del asset['id']
                tx['asset'] = asset

        tx_ids = list(tx_map.keys())
        metadata_list = list(bigchain.get_metadata(tx_ids))
        for metadata in metadata_list:
            tx = tx_map[metadata['id']]
            tx.update({'metadata': metadata.get('metadata')})

        if return_list:
            tx_list = []
            for tx_id, tx in tx_map.items():
                tx_list.append(cls.from_dict(tx))
            return tx_list
        else:
            tx = list(tx_map.values())[0]
            return cls.from_dict(tx)