Is this really clearer than

```python
fullpath = urllib.quote(base_path)
if query != '':
    fullpath = "%s?%s" % (fullpath, query)
```

?