Misc. py3+ fixes and @thobbs own if/else/elif fix.