add support for python 3

commands are still backwards compatible for python 2 as well. tested on Mac OS X for both, as well as Windows