def get_ipython_shell():
    'Detect if running within IPython and returns its `ip` (shell) object\n\n    Returns None if not under ipython (no `get_ipython` function)\n    '
    try:
        return get_ipython()
    except NameError:
        return None
Detect if running within IPython and returns its `ip` (shell) object

Returns None if not under ipython (no `get_ipython` function)
def get_ipython_shell():
    'Detect if running within IPython and returns its `ip` (shell) object\n\n    Returns None if not under ipython (no `get_ipython` function)\n    '
    try:
        return get_ipython()
    except NameError:
        return None