code: def is_notebook() -> bool:
      try:
          shell = get_ipython().__class__.__name__
          if "google.colab" in sys.modules:
              return True
          elif shell == "ZMQInteractiveShell":
              return True  # Jupyter notebook or qtconsole
          elif shell == "TerminalInteractiveShell":
              return False  # Terminal running IPython
          else:
              return False  # Other type (?)
      except NameError:
          return False
  
file_path: ktrain/ktrain/text/qa/generative_qa.py
imports: import sys
  import os
  import pickle
  from typing import Optional
  from pathlib import Path
label_desc: Use image node_id 1 for calling a global function with example usage: is_notebook() and returns: True, False, True, False, False