A more general way to handle it would be
```python
try:
    import wx.lib.agw.aui as aui
except ImportError:
    import wx.aui as aui
```