```python
try:
    import gi
except ImportError:
    pass
else:
    raise Exception('Avoiding PyGST, Gi is better.')
```

I think the above is cleaner.