code: func IsISBN(str string, version int) bool {
  	r, _ := regexp.Compile("[\\s-]+")
  	sanitized := r.ReplaceAll([]byte(str), []byte(""))
  	var checksum int32
  	var i int32
  	if version == 10 {
  		if !rxISBN10.MatchString(string(sanitized)) {
  			return false
  		}
  		for i = 0; i < 9; i++ {
  			checksum += (i + 1) * int32(sanitized[i]-'0')
  		}
  		if sanitized[9] == 'X' {
  			checksum += 10 * 10
  		} else {
  			checksum += 10 * int32(sanitized[9]-'0')
  		}
  		if checksum%11 == 0 {
  			return true
  		}
  		return false
  	} else if version == 13 {
  		if !rxISBN13.MatchString(string(sanitized)) {
  			return false
  		}
  		factor := []int32{1, 3}
  		for i = 0; i < 12; i++ {
  			checksum += factor[i%2] * int32(sanitized[i]-'0')
  		}
  		if (int32(sanitized[12]-'0'))-((10-(checksum%10))%10) == 0 {
  			return true
  		}
  		return false
  	}
  	return IsISBN(str, 10) || IsISBN(str, 13)
  }
docs: // IsISBN check if the string is an ISBN (version 10 or 13).
  // If version value is not equal to 10 or 13, it will be check both variants.