code: func BytesToTrits(bytes []byte, numTrits ...int) (trits Trits, err error) {
  	bytesLength := len(bytes)
  	tritsLength := bytesLength * NumberOfTritsInAByte
  
  	if len(numTrits) > 0 {
  		tritsLength = numTrits[0]
  
  		minTritLength := (bytesLength-1)*NumberOfTritsInAByte + 1
  		maxTritLength := bytesLength * NumberOfTritsInAByte
  		if tritsLength < minTritLength || tritsLength > maxTritLength {
  			return nil, errors.Wrapf(ErrInvalidTritsLength, "must be %d-%d in size", minTritLength, maxTritLength)
  		}
  	}
  
  	trits = make(Trits, tritsLength)
  
  	for byteNum := 0; byteNum < bytesLength; byteNum++ {
  		value := int8(bytes[byteNum])
  
  		tritOffset := byteNum * NumberOfTritsInAByte
  
  		for tritNum := NumberOfTritsInAByte - 1; tritNum >= 0; tritNum-- {
  			var trit int8 = 0
  
  			tritIdx := tritOffset + tritNum
  
  			if tritIdx < tritsLength {
  				byteRadixHalf := byteRadix[tritNum] >> 1
  				if value > byteRadixHalf {
  					value -= byteRadix[tritNum]
  					trit = 1
  				} else if value < (-byteRadixHalf) {
  					value += byteRadix[tritNum]
  					trit = -1
  				}
  
  				trits[tritIdx] = trit
  			}
  		}
  	}
  	return trits, nil
  }
docs: // BytesToTrits unpacks an array of bytes into an array of trits