modified utils.py in order to work properly with python2 and python3