Upgrade to Python 2.7 runtime

Changes are rather small and don't seem to break anything.