Python2 compatibility issue