Code style update based on PEP style guide

* Now imports urllib.error as urlerror
* Other changes according to http://legacy.python.org/dev/peps/pep-0008/