borrowed code from buildbot fiximports.py to validate and fix import issues in #112

borrowed code from https://github.com/buildbot/buildbot/blob/master/common/fiximports.py to validate and fix import issues in #112