def METHOD_NAME(self, topic, qos=0):
    assert self.cb is not None, "Subscribe callback is not set"
    pkt = bytearray(b"\x82\0\0\0")
    self.pid += 1
    struct.pack_into("!BH", pkt, 1, 2 + 2 + len(topic) + 1, self.pid)
    # print(hex(len(pkt)), hexlify(pkt, ":"))
    self.sock.write(pkt)
    self._send_str(topic)
    self.sock.write(qos.to_bytes(1, "little"))
    while 1:
        op = self.wait_msg()
        if op == 0x90:
            resp = self.sock.read(4)
            # print(resp)
            assert resp[1] == pkt[2] and resp[2] == pkt[3]
            if resp[3] == 0x80:
                raise MQTTException(resp[3])
            return