Some initial work on getting codebase python3-ready.
Finished updates for py3k-compatible codebase.