docs: def write_terminal_win(matrix, version, border=None):  # pragma: no cover
      """\
      Function to write a QR Code to a MS Windows terminal.
  
      :param matrix: The matrix to serialize.
      :param int version: The (Micro) QR code version
      :param int border: Integer indicating the size of the quiet zone.
              If set to ``None`` (default), the recommended border size
              will be used (``4`` for QR Codes, ``2`` for a Micro QR Codes).
      """
      import sys
      import struct
      import ctypes
      write = sys.stdout.write
      std_out = ctypes.windll.kernel32.GetStdHandle(-11)
      csbi = ctypes.create_string_buffer(22)
      res = ctypes.windll.kernel32.GetConsoleScreenBufferInfo(std_out, csbi)
      if not res:
          raise OSError('Cannot find information about the console. '
                        'Not running on the command line?')
      default_color = struct.unpack(b'hhhhHhhhhhh', csbi.raw)[4]
      set_color = partial(ctypes.windll.kernel32.SetConsoleTextAttribute, std_out)
      colours = (240, default_color)
      for row in matrix_iter(matrix, version, scale=1, border=border):
          prev_bit = -1
          cnt = 0
          for bit in row:
              if bit == prev_bit:
                  cnt += 1
              else:
                  if cnt:
                      set_color(colours[prev_bit])
                      write('  ' * cnt)
                  prev_bit = bit
                  cnt = 1
          if cnt:
              set_color(colours[prev_bit])
              write('  ' * cnt)
          set_color(default_color)  # reset color
          write('\n')