<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calculate(self, order, transaction):
 """ Pay commission based on dollar value of shares. """

        cost_per_share = transaction.price * self.cost_per_dollar
        return abs(transaction.amount) * cost_per_share