This contains changes from master that were reverted by @jm due incompatibility with python3.
This will create a new commit in order to revert the existing changes.