code: def is_repl():
      """Return True if running in the Python REPL."""
      import inspect
  
      root_frame = inspect.stack()[-1]
      filename = root_frame[1]  # 1 is the filename field in this tuple.
  
      if filename.endswith(os.path.join("bin", "ipython")):
          return True
  
      # <stdin> is what the basic Python REPL calls the root frame's
      # filename, and <string> is what iPython sometimes calls it.
      if filename in ("<stdin>", "<string>"):
          return True
  
      return False
  
imports: import os
  import platform
  import re
  import sys
label_desc: Use image node_id 2 for calling a global function with example usage: is_repl() and returns: False, True, True