'Get the asset id from a list of :class:`~.Transactions`.
This is useful when we want to check if the multiple inputs of a
transaction are related to the same asset id.
Args:
transactions (:obj:`list` of :class:`~bigchaindb.common.
transaction.Transaction`): A list of Transactions.
Usually input Transactions that should have a matching
asset ID.
Returns:
str: ID of the asset.
Raises:
:exc:`AssetIdMismatch`: If the inputs are related to different
assets.'

@staticmethod
def get_asset_id(transactions):

    if (not isinstance(transactions, list)):
        transactions = [transactions]
    asset_ids = {(tx.id if (tx.operation == Transaction.CREATE) else tx.asset['id']) for tx in transactions}
    if (len(asset_ids) > 1):
        raise AssetIdMismatch('All    inputs    of    all    transactions    passed    need    to    have    the    same    asset    id')
    return asset_ids.pop()
