Ported the calculator gadget to python