Rewriting calc.py in Python 2.7