Changes to support python3

Unit tests still pass and my simple use case works as well.