code: def _is_ipython(shell):
      """Is a shell instance an IPython shell?"""
      # shortcut, so we don't import IPython if we don't have to
      from sys import modules
  
      if "IPython" not in modules:
          return False
      try:
          from IPython.core.interactiveshell import InteractiveShell
      except ImportError:
          # IPython < 0.11
          try:
              from IPython.iplib import InteractiveShell
          except ImportError:
              # Reaching this points means IPython has changed in a backward-incompatible way
              # that we don't know about. Warn?
              return False
      return isinstance(shell, InteractiveShell)
  
file_path: sympy/sympy/interactive/printing.py
imports: from sympy.external.importtools import version_tuple
  from io import BytesIO
  from sympy.printing.latex import latex
  from sympy.printing.preview import preview
  from sympy.utilities.misc import debug
  from sympy.printing.defaults import Printable
label_desc: Use image node_id 3 for calling a global function with example usage: _is_ipython(shell) and returns: isinstance, False, False