I think that's appropriate.  I guess the function would be:

```python
def get_ipython():
    import sys
    if 'IPython' in sys.modules:
        import IPython
        return IPython.get_ipython()
```