docs: def write_pad_codewords(buff, version, capacity, length):
      """\
      Writes the pad codewords iff the data does not fill the capacity of the
      symbol.
  
      :param buff: The byte buffer.
      :param int version: The (Micro) QR Code version.
      :param int capacity: The total capacity of the symbol (incl. error correction)
      :param int length: Length of the data bit stream.
      """
      # ISO/IEC 18004:2015(E) -- 7.4.10 Bit stream to codeword conversion (page 32)
      # The message bit stream shall then be extended to fill the data capacity
      # of the symbol corresponding to the Version and Error Correction Level, as
      # defined in Table 8, by adding the Pad Codewords 11101100 and 00010001
      # alternately. For Micro QR Code versions M1 and M3 symbols, the final data
      # codeword is 4 bits long. The Pad Codeword used in the final data symbol
      # character position in Micro QR Code versions M1 and M3 symbols shall be
      # represented as 0000.
      write = buff.extend
      if version in (consts.VERSION_M1, consts.VERSION_M3):
          write([0] * (capacity - length))
      else:
          pad_codewords = ((1, 1, 1, 0, 1, 1, 0, 0), (0, 0, 0, 1, 0, 0, 0, 1))
          for i in range(capacity // 8 - length // 8):
              write(pad_codewords[i % 2])