Modified script to work in both python2 and python3
Merge branch 'python3'