code: def get_csbi(filehandle=None):
      
  
      if filehandle is None:
          filehandle = msvcrt.get_osfhandle(sys.__stdout__.fileno())
  
      csbi = ConsoleScreenBufferInfo()
      KERNEL32.GetConsoleScreenBufferInfo(filehandle, ctypes.byref(csbi))
      return csbi
docs: Returns a CONSOLE_SCREEN_BUFFER_INFO structure for the given console or stdout