@classmethod
    def decode_frame(cls, frame):
        if not isinstance(frame, bytes):
            frame = frame.encode('utf-8')

        try:
            # get header and body
            header, body = frame.split(b"\0")

            # parse header
            # since we have only 1 version of the protocol we can ignore for now
            # the magic bit.
            _, type, id = header.split()

            # return the message classe
            return cls(body, id=id, type=type)
        except ValueError:
            raise MessageError("invalid message %r" % frame)
dataset/ETHPy150Open benoitc/gaffer/gaffer/message.py/Message.decode_frame/original