Add python script-level headers
Change tabs to spaces
Add docstring; change Exception clause