def METHOD_NAME(self, msg, data={}, wait_response=True):
    if self.socket is None:
        return {"Ret": 101}
    # self.busy.wait()
    self.busy.acquire()
    if hasattr(data, "__iter__"):
        if sys.version_info[0] > 2:
            data = bytes(json.dumps(data, ensure_ascii=False), "utf-8")
        else:
            data = json.dumps(data, ensure_ascii=False)
    pkt = (
        struct.pack(
            "BB2xII2xHI",
            255,
            0,
            self.session,
            self.packet_count,
            msg,
            len(data) + 2,
        )
        + data
        + b"\x0a\x00"
    )
    self.logger.debug("=> %s", pkt)
    self.socket_send(pkt)
    if wait_response:
        reply = {"Ret": 101}
        (
            head,
            version,
            self.session,
            sequence_number,
            msgid,
            len_data,
        ) = struct.unpack("BB2xII2xHI", self.socket_recv(20))
        reply = self.receive_json(len_data)
        self.busy.release()
        return reply