code: def is_notebook_environment():
      try:
          shell = get_ipython().__class__.__name__
          if shell == "ZMQInteractiveShell":
              return True  # IPython Notebook
          elif shell == "Shell":
              return True  # Colaboratory Notebook
          elif shell == "TerminalInteractiveShell":
              return False  # Terminal running IPython
          else:
              return False  # Other unknown type (?)
      except NameError:
          return False
  
label_desc: Use image node_id 1 for calling a global function with example usage: is_notebook_environment() and returns: True, False, True, False, False