Made Python 2.7/3.x compatible.