def __init__(self, opcode, data=b'', encoding='utf-8'):
        """
        A message is a application level entity. It's usually built
        from one or many frames. The protocol defines several kind
        of messages which are grouped into two sets:

        * data messages which can be text or binary typed
        * control messages which provide a mechanism to perform
          in-band control communication between peers

        The ``opcode`` indicates the message type and ``data`` is
        the possible message payload.

        The payload is held internally as a a :func:`bytearray` as they are
        faster than pure strings for append operations.

        Unicode data will be encoded using the provided ``encoding``.
        """
        self.opcode = opcode
        self._completed = False
        self.encoding = encoding

        if isinstance(data, unicode):
            if not encoding:
                raise TypeError("unicode data without an encoding")
            data = data.encode(encoding)
        elif isinstance(data, bytearray):
            data = bytes(data)
        elif not isinstance(data, bytes):
            raise TypeError(type(data) % "%s is not a supported data type")

        self.data = data
dataset/ETHPy150Open Lawouach/WebSocket-for-Python/ws4py/messaging.py/Message.__init__/swapped operands of `%`