Something like:

```
try:
    import Qt
    HAS_PYQT = True
except ImportError:
    HAS_PYQT = False
```

(And obviously extend to also check for PySide -- it should be good enough to have one or the other).