Update for python 2.7

Changes required for Python 2.7 support on Google AppEngine