def _is_ipython(shell):
 if ('IPython' not in sys.modules):
  return False
 try:
  from IPython.core.interactiveshell import InteractiveShell
 except ImportError:
  try:
   from IPython.iplib import InteractiveShell
  except ImportError:
   return False
 return isinstance(shell, InteractiveShell)

def _is_ipython ( shell ) : if ( 'IPython' not in sys . modules ) : return False try : from IPython . core . interactiveshell import InteractiveShell except ImportError : try : from IPython . iplib import InteractiveShell except ImportError : return False return isinstance ( shell , InteractiveShell )
is a shell instance an ipython shell? .