Improve Python 3 compat, clean up code

Further improve compatibility with Python 3 by making the `urlparse` import
conditional. Make both pylint2 and pylint3 happy with the conditional imports.

Make some sed expressions use "|" as a separator instead of "/", thus allowing
all occurrences of "\/" to be removed.

Update some comments and shuffle around code to make it more compact and
readable.
Merge pull request #42 from Ichimonji10/noodles

Improve Python 3 compat, clean up code