code: func IsChannelNameValid(channel string, wildcardsAllowed bool) bool {
  	if channel == "" || channel[0] == btsep {
  		return false
  	}
  	for i := 0; i < len(channel); i++ {
  		c := channel[i]
  		if c == '/' {
  			return false
  		}
  		if (c == btsep) && (i == len(channel)-1 || channel[i+1] == btsep) {
  			return false
  		}
  		if !wildcardsAllowed {
  			if c == pwc || c == fwc {
  				return false
  			}
  		} else if c == pwc || c == fwc {
  			if i > 0 && channel[i-1] != btsep {
  				return false
  			}
  			if c == fwc && i != len(channel)-1 {
  				return false
  			}
  			if i < len(channel)-1 && channel[i+1] != btsep {
  				return false
  			}
  		}
  	}
  	return true
  }
docs: // IsChannelNameValid returns false if any of these conditions for
  // the channel name apply:
  // - is empty
  // - contains the `/` character
  // - token separator `.` is first or last
  // - there are two consecutives token separators `.`
  // if wildcardsAllowed is false:
  // - contains wildcards `*` or `>`
  // if wildcardsAllowed is true:
  // - '*' or '>' are not a token in their own
  // - `>` is not the last token