code: def is_terminal():
      """
      Detect if Python is running in a terminal.
  
      Returns True if Python is running in a terminal or False if not.
      """
      try:
          ip = get_ipython()
      except (
          NameError
      ):  # assume standard Python interpreter in a terminal
          return True
      else:
          if hasattr(ip, "kernel"):  # IPython as a Jupyter kernel
              return False
          else:  # IPython in a terminal
              return True
  
file_path: catboost/contrib/python/pandas/py2/pandas/io/formats/terminal.py
imports: from __future__ import print_function
  import os
  import shutil
  import subprocess
  from pandas.compat import PY3
label_desc: Use image node_id 2 for calling a global function with example usage: is_terminal() and returns: True, False, True