[`path.py`](http://pythonhosted.org/path.py/api.html) provides a much nicer API than the `os.path` module, and we try to use it when we can. You can do something like:
```python
theme_root = path(theme_root)
if theme_root.isdir():
    if (theme_root / ".git").isdir():
        # etc
```