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 __repr__(self):
      if isinstance(self._cost_per_contract, DummyMapping):
          # Cost per contract is a constant, so extract it.
          cost_per_contract = self._cost_per_contract["dummy key"]
      else:
          cost_per_contract = "<varies>"
  
      if isinstance(self._exchange_fee, DummyMapping):
          # Exchange fee is a constant, so extract it.
          exchange_fee = self._exchange_fee["dummy key"]
      else:
          exchange_fee = "<varies>"
  
      return (
          "{class_name}(cost_per_contract={cost_per_contract}, "
          "exchange_fee={exchange_fee}, min_trade_cost={min_trade_cost})".format(
              class_name=self.__class__.__name__,
              cost_per_contract=cost_per_contract,
              exchange_fee=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 2 for calling the PerContract obj's underlying member method code with example usage: obj.__repr__() and returns: str