code: func AddChecksum(input Trytes, isAddress bool, checksumLength uint64) (Trytes, error) {
  	if isAddress && len(input) != HashTrytesSize {
  		if len(input) == AddressWithChecksumTrytesSize {
  			return input, nil
  		}
  		return "", ErrInvalidAddress
  	}
  
  	if checksumLength < MinChecksumTrytesSize ||
  		(isAddress && checksumLength != AddressChecksumTrytesSize) {
  		return "", ErrInvalidChecksum
  	}
  
  	inputCopy := input
  
  	for len(inputCopy)%HashTrytesSize != 0 {
  		inputCopy += "9"
  	}
  
  	inputTrits := MustTrytesToTrits(inputCopy)
  	k := kerl.NewKerl()
  	if err := k.Absorb(inputTrits); err != nil {
  		return "", err
  	}
  	checksumTrits, err := k.Squeeze(HashTrinarySize)
  	if err != nil {
  		return "", err
  	}
  	input += MustTritsToTrytes(checksumTrits[HashTrinarySize-checksumLength*3 : HashTrinarySize])
  	return input, nil
  }
docs: // AddChecksum computes the checksum and returns the given trytes with the appended checksum.
  // If isAddress is true, then the input trytes must be of length HashTrytesSize.
  // Specified checksum length must be at least MinChecksumTrytesSize long or it must be
  // AddressChecksumTrytesSize if isAddress is true.