```
url = "http://localhost/admin/%s%s" % (endpoint, extension)
try:
   url = kwargs['url']
except KeyError:
   pass
```

Note the spacing in your string interpolation is missing also.