code: def get_console_size() -> tuple[int | None, int | None]:
      """
      Return console size as tuple = (width, height).
  
      Returns (None,None) in non-interactive session.
      """
      from pandas import get_option
  
      display_width = get_option("display.width")
      display_height = get_option("display.max_rows")
  
      # Consider
      # interactive shell terminal, can detect term size
      # interactive non-shell terminal (ipnb/ipqtconsole), cannot detect term
      # size non-interactive script, should disregard term size
  
      # in addition
      # width,height have default values, but setting to 'None' signals
      # should use Auto-Detection, But only in interactive shell-terminal.
      # Simple. yeah.
  
      if in_interactive_session():
          if in_ipython_frontend():
              # sane defaults for interactive non-shell terminal
              # match default for width,height in config_init
              from pandas._config.config import get_default_val
  
              terminal_width = get_default_val("display.width")
              terminal_height = get_default_val("display.max_rows")
          else:
              # pure terminal
              terminal_width, terminal_height = get_terminal_size()
      else:
          terminal_width, terminal_height = None, None
  
      # Note if the User sets width/Height to None (auto-detection)
      # and we're in a script (non-inter), this will return (None,None)
      # caller needs to deal.
      return (
          display_width or terminal_width,
          display_height or terminal_height,
      )
  
imports: from __future__ import annotations
  from shutil import get_terminal_size
label_desc: Use image node_id 1 for calling a global function with example usage: get_console_size() and returns: unknown,  unknown