rewrite in Python 3, for testability
use real files in temp dirs for testing
use real files in temp dirs for testing, not mocks