code: def pad(data, blocksize=16):
      
      padlen = blocksize - len(data) % blocksize
      return bytes(data + bytearray(range(1, padlen)) + bytearray((padlen - 1,)))
docs: Pads data to blocksize according to RFC 4303. Pad length field is included in output.