Python 3 support

Todo:

- Refactor setopt to not build python parameter tuple