Python 3 support

In Python 3 `urlparse` is a part of `urllib`. This try/except is needed
to import the module from the right location.