Update url_key.py

Cleaned up the code a bit more. Should fix issue #1.