async def METHOD_NAME(nc: "NATSClient", sub, data, names) -> str:
    try:
        msg = await nc.request(
            subject=sub, payload=msgpack.dumps(data), timeout=5
        )
    except TimeoutError:
        return "timeout"
    try:
        r = msgpack.loads(msg.data)
    except Exception as e:
        return str(e)
    if not isinstance(r, list):
        return "notlist"
    for name in r:
        if name.startswith(exclude_tasks):
            # skip system tasks or any pending reboots
            continue
        if name.startswith("TacticalRMM_") and name not in names:
            nats_data = {
                "func": "delschedtask",
                "schedtaskpayload": {"name": name},
            }
            print(f"Deleting orphaned task: {name} on agent {sub}")
            await nc.publish(subject=sub, payload=msgpack.dumps(nats_data))
    return "ok"