def METHOD_NAME(self, i3, event=None):
    scratchpad = i3.get_tree().scratchpad()
    if not scratchpad:
        return
    # Workaround for I3ipc 2.2.1 not finding leaves() in sway. Fixing: #2038
    leaves = getattr(scratchpad, "floating_nodes", [])
    temporary = {
        "ipc": self.parent.ipc,
        "scratchpad": len(leaves),
        "urgent": sum(window.urgent for window in leaves),
    }
    if self.scratchpad_data != temporary:
        self.scratchpad_data = temporary
        self.parent.py3.METHOD_NAME()