code: def _detect_ipython_zmq():
      """Detect if running in an IPython environment using ZMQ.
  
      i.e. notebook/qtconsole/lab.
  
      Mostly derived from StackOverflow below:
      https://stackoverflow.com/questions/15411967/how-can-i-check-if-code-is-executed-in-the-ipython-notebook/24937408
  
      Returns
      -------
          True if called in IPython notebook or qtconsole.
  
      """
      try:
          from IPython import get_ipython
  
          shell = get_ipython().__class__.__name__
          if shell == "ZMQInteractiveShell":
              return True  # Jupyter notebook or qtconsole
          elif shell == "TerminalInteractiveShell":
              return False  # Terminal running IPython
          else:
              return False  # Other type (?)
      except NameError:  # pragma: no cover
          return False
  
file_path: responsible-ai-toolbox/rai_core_flask/rai_core_flask/environment_detector.py
imports: import os
  from .environments import AzureNBEnvironment, CredentialedVMEnvironment, DatabricksEnvironment, LocalIPythonEnvironment, PublicVMEnvironment
label_desc: Use image node_id 2 for calling a global function with example usage: _detect_ipython_zmq() and returns: True, False, False, False