Python 3 improvements set 2

Some fairly simple changes to bring us closer to python3 support.