fix syntax error in python3

fixed syntax error in python3 and tested version 2.7 and 3.3