Move import urlparse to the top of the file

Is the only import that was done locally, and now is used in more than
one place, so it makes sense to have it at the top like the rest.