Further simplification in progress.
Let's use the stdlib io system for great sanity.
Fix Python 3.x support.
merge