<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, root_device='/'):
 """ Detect all currently known devices. :param str root_device: object path of root device to return :returns: root node of device hierarchy """

        root = Device(None, [], None, "", [])
        device_nodes = dict(map(self._device_node,
                                self._mounter.get_all_handleable()))
        # insert child devices as branches into their roots:
        for node in device_nodes.values():
            device_nodes.get(node.root, root).branches.append(node)
        device_nodes['/'] = root
        for node in device_nodes.values():
            node.branches.sort(key=lambda node: node.label)
        return device_nodes[root_device]