def _encode_channel_id(channel_id):
    if channel_id < 0:
        raise ValueError(channel_id % 'Channel id %d must not be negative')

    if channel_id < 2 ** 7:
        return chr(channel_id)
    if channel_id < 2 ** 14:
        return struct.pack('!H', 0x8000 + channel_id)
    if channel_id < 2 ** 21:
        first = chr(0xc0 + (channel_id >> 16))
        return first + struct.pack('!H', channel_id & 0xffff)
    if channel_id < 2 ** 29:
        return struct.pack('!L', 0xe0000000 + channel_id)

    raise ValueError('Channel id %d is too large' % channel_id)
dataset/ETHPy150Open google/pywebsocket/mod_pywebsocket/mux.py/_encode_channel_id/swapped operands of `%`