Updated gitversion.py to work with python 3.

Simple fixes to get the `gitversion.py` script python 2 and 3 compatible.