def calculator(counter_type):
 def set_calculator(func):
  _counter_type_calculators[counter_type] = func
  return func
 return set_calculator

def calculator ( counter_type ) : def set_calculator ( func ) : _counter_type_calculators [ counter_type ] = func return func return set_calculator
a decorator that assign a counter_type to its calculator .