code: def get_terminal_size():
      """Return current terminal size"""
      if on_windows:
          try:
              from ctypes import windll, create_string_buffer
  
              # stdin handle is -10
              # stdout handle is -11
              # stderr handle is -12
  
              h = windll.kernel32.GetStdHandle(-12)
              csbi = create_string_buffer(22)
              res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
          except:
              return None, None
          if res:
              (
                  bufx,
                  bufy,
                  curx,
                  cury,
                  wattr,
                  left,
                  top,
                  right,
                  bottom,
                  maxx,
                  maxy,
              ) = struct.unpack("hhhhHhhhhhh", csbi.raw)
              sizex = right - left + 1
              sizey = bottom - top + 1
              return sizex, sizey
          else:
              return None, None
      else:
          import fcntl
          import termios
  
          try:
              h, w, hp, wp = struct.unpack(
                  "HHHH",
                  fcntl.ioctl(
                      0,
                      termios.TIOCGWINSZ,
                      struct.pack("HHHH", 0, 0, 0, 0),
                  ),
              )
              return w, h
          except:
              return None, None
  
imports: from datalad.support import ansi_colors
  from datalad.utils import on_windows
  import struct
label_desc: Use image node_id 1 for calling a global function with example usage: get_terminal_size() and returns: sizex,  sizey, None,  None, w,  h, None,  None, None,  None