code: def _find_monitor(monitors, handle):
      
  
      found_devs = set()
      found_events = set()
  
      for conn_string, device in monitors.items():
          for event, handles in device.items():
              if handle in handles:
                  found_events.add(event)
                  found_devs.add(conn_string)
  
      return found_devs, found_events
docs: Find all devices and events with a given monitor installed.