def format(self):
        """
        format this object to string(byte array) to send data to server.
        """
        if not _is_bool(self.fin, self.rsv1, self.rsv2, self.rsv3):
            raise ValueError("not 0 or 1")
        if self.opcode not in ABNF.OPCODES:
            raise ValueError("Invalid OPCODE")
        length = len(self.data)
        if length >= ABNF.LENGTH_63:
            raise ValueError("data is too long")

        frame_header = []
        frame_header = bytes((self.fin << 7
                           | self.rsv1 << 6 | self.rsv2 << 5 | self.rsv3 << 4
                           | self.opcode,))
        if ABNF.LENGTH_7 < length:
            frame_header += bytes((self.mask << 7 | length,))
        elif length < ABNF.LENGTH_16:
            frame_header += bytes((self.mask << 7 | 0x7e,))
            frame_header += struct.pack("!H", length)
        else:
            frame_header += bytes((self.mask << 7 | 0x7f,))
            frame_header += struct.pack("!Q", length)

        if not self.mask:
            return frame_header + self.data
        else:
            mask_key = self.get_mask_key(4)
            return frame_header + self._get_masked(mask_key)
dataset/ETHPy150Open sokolovstas/SublimeWebInspector/websocket.py/ABNF.format/swapped operands of `<`