Move the body of extern/six.py into a function so that any variables it uses (namely mod_info, which includes an open filehandle) go out of scope when they're no longer needed.  Fixes #3156.
Merge pull request #3156 from embray/issue-3156

Message about unclosed files in affiliated packages