def METHOD_NAME(ns):
    with open(ns.device_path, "rb") as fd:
        d = libevdev.Device(fd)
        if not d.absinfo[libevdev.EV_ABS.ABS_MISC]:
            die("Device only supports generic styli")
        tool_bits = set(
            c for c in libevdev.EV_KEY.codes if c.name.startswith("BTN_TOOL_")
        )
        styli = {}  # dict of (type, serial) = proximity_state
        current_type, current_serial = 0, 0
        in_prox = False
        dirty = False
        print("Please put tool in proximity")
        try:
            while True:
                for event in d.events():
                    if event.matches(libevdev.EV_ABS.ABS_MISC):
                        if event.value != 0:
                            current_type = event.value
                            dirty = True
                    elif event.matches(libevdev.EV_MSC.MSC_SERIAL):
                        if event.value != 0:
                            current_serial = event.value & 0xFFFFFFFF
                            dirty = True
                    elif event.code in tool_bits:
                        # print(f'Current prox: {event.value}')
                        in_prox = event.value != 0
                        dirty = True
                    elif event.matches(libevdev.EV_SYN.SYN_REPORT) and dirty:
                        dirty = False
                        print(
                            f"{Ansi.up(len(styli))}{Ansi.left(10000)}{Ansi.clearline}",
                            end="",
                        )
                        styli[(current_type, current_serial)] = in_prox
                        for s, prox in styli.items():
                            tid, serial = s
                            print(
                                f"Tool id {tid:#x} serial {serial:#x} in-proximity: {prox} "
                            )
        except KeyboardInterrupt:
            print("Terminating")
        return [s[0] for s in styli.keys()]