Make sort imports more pythonic and human readable

Use of `with` statement, pythonic pattern which automatically closes file after it's been opened.
Docstrings for brief explanation of what this does as per PEP8.
if __name__ == "__main__" pythonic pattern used for if someone actually decides to import this script.

Otherwise, implementation hasn't been changed.

Suggestions:
- This script seems like a core utility, it should be independently tested; **was unable to locate unit tests**.
- Its procedural implementation makes it difficult be tested well.
Merge pull request #407 from pygeek/patch-1

Make sort_imports.py more pythonic and human readable