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