code: def in_notebook():
      """Based on: https://stackoverflow.com/a/22424821/1565454"""
      try:
          from IPython import get_ipython
  
          ipy = get_ipython()
          if (
              ipy is None
              or not hasattr(ipy, "config")
              or not isinstance(ipy.config, dict)
              or "IPKernelApp" not in ipy.config
          ):
              return False
      except ImportError:
          return False
  
      return True
  
label_desc: Use image node_id 2 for calling a global function with example usage: in_notebook() and returns: True, False, False