<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def detect(self):
 """Detect all currently known devices. Returns the root device."""

        root = self._actions.detect()
        prune_empty_node(root, set())
        return root