def get_windows_terminal_size():
    """Get the terminal size of a Windows OS terminal."""
    from ctypes import windll, create_string_buffer
    handle = windll.kernel32.GetStdHandle(-12)
    try:
        csbi = create_string_buffer(22)
        res = windll.kernel32.GetConsoleScreenBufferInfo(handle, csbi)
    except (IOError, OSError):
        return None
    if res:
        import struct
        (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
