class_docstr: Calculates a commission for a transaction based on a per contract cost with
  an optional minimum cost per trade.
  
  Parameters
  ----------
  cost : float or dict
      The amount of commissions paid per contract traded. If given a float,
      the commission for all futures contracts is the same. If given a
      dictionary, it must map root symbols to the commission cost for
      contracts of that symbol.
  exchange_fee : float or dict
      A flat-rate fee charged by the exchange per trade. This value is a
      constant, one-time charge no matter how many contracts are being
      traded. If given a float, the fee for all contracts is the same. If
      given a dictionary, it must map root symbols to the fee for contracts
      of that symbol.
  min_trade_cost : float, optional
      The minimum amount of commissions paid per trade.
class_docstr_tok: ["Calculates","a","commission","for","a","transaction","based","on","a","per","contract","cost","with","an","optional","minimum","cost","per","trade",".","Parameters","--","--","--","--","--","cost",":","float","or","dict","The","amount","of","commissions","paid","per","contract","traded",".","If","given","a","float",",","the","commission","for","all","futures","contracts","is","the","same",".","If","given","a","dictionary",",","it","must","map","root","symbols","to","the","commission","cost","for","contracts","of","that","symbol",".","exchange_fee",":","float","or","dict","A","flat-rate","fee","charged","by","the","exchange","per","trade",".","This","value","is","a","constant",",","one-time","charge","no","matter","how","many","contracts","are","being","traded",".","If","given","a","float",",","the","fee","for","all","contracts","is","the","same",".","If","given","a","dictionary",",","it","must","map","root","symbols","to","the","fee","for","contracts","of","that","symbol",".","min_trade_cost",":","float",",","optional","The","minimum","amount","of","commissions","paid","per","trade","."]
code: def calculate(self, order, transaction):
      root_symbol = order.asset.root_symbol
      cost_per_contract = self._cost_per_contract[root_symbol]
      exchange_fee = self._exchange_fee[root_symbol]
  
      return calculate_per_unit_commission(
          order=order,
          transaction=transaction,
          cost_per_unit=cost_per_contract,
          initial_commission=exchange_fee,
          min_trade_cost=self.min_trade_cost,
      )
  
imports: from abc import abstractmethod
  from collections import defaultdict
  from six import with_metaclass
  from toolz import merge
  from catalyst.assets import Equity, Future
  from catalyst.finance.constants import FUTURE_EXCHANGE_FEES_BY_SYMBOL
  from catalyst.finance.shared import AllowedAssetMarker, FinancialModelMeta
  from catalyst.utils.dummy import DummyMapping
label_desc: Use image node_id 3 for calling the PerContract obj's underlying member method code with example usage: obj.calculate(order, transaction) and returns: calculate_per_unit_commission