deviceTreeLookup :: Text -> DeviceTree -> Maybe DeviceTree
deviceTreeLookup path root = case bkPath path of
   (x,xs)
      | Text.null x 
        && Text.null xs -> error "deviceTreeLookup': empty path"
      | otherwise       -> do
         n <- Map.lookup x (deviceNodeChildren root)
         if Text.null xs
            then Just n
            else deviceTreeLookup xs n

-- remove a node in the tree
deviceTreeLookup :: Text -> DeviceTree -> Maybe DeviceTree
deviceTreeLookup path root = case bkPath path of
   (x,xs)
      | Text.null x 
        && Text.null xs -> error "deviceTreeLookup': empty path"
      | otherwise       -> do
         n <- Map.lookup x (deviceNodeChildren root)
         if Text.null xs
            then Just n
            else deviceTreeLookup xs n

-- remove a node in the tree
deviceTreeLookup path root = case bkPath path of
   (x,xs)
      | Text.null x 
        && Text.null xs -> error "deviceTreeLookup': empty path"
      | otherwise       -> do
         n <- Map.lookup x (deviceNodeChildren root)
         if Text.null xs
            then Just n
            else deviceTreeLookup xs n

-- remove a node in the tree