nsidToFriendlyName' context target = do
  allNS <- (M.toList . L2.l2nsNamespaces) <$> getNamespaceContents "friendlyname'" context
  foldM (\m (nsname, nsid) -> (liftM (mplus m)) (if nsid == target
                                           then return (Just nsname)
                                           else (liftM $ ((nsname <> "::") <>)) <$>
                                                  nsidToFriendlyName' nsid target))
        Nothing allNS

-- Utility functions for working with L2 models...
-- | Fetch the current L2 model out of the state.
nsidToFriendlyName' context target = do
  allNS <- (M.toList . L2.l2nsNamespaces) <$> getNamespaceContents "friendlyname'" context
  foldM (\m (nsname, nsid) -> (liftM (mplus m)) (if nsid == target
                                           then return (Just nsname)
                                           else (liftM $ ((nsname <> "::") <>)) <$>
                                                  nsidToFriendlyName' nsid target))
        Nothing allNS

-- Utility functions for working with L2 models...
-- | Fetch the current L2 model out of the state.
nsidToFriendlyName' context target = do
  allNS <- (M.toList . L2.l2nsNamespaces) <$> getNamespaceContents "friendlyname'" context
  foldM (\m (nsname, nsid) -> (liftM (mplus m)) (if nsid == target
                                           then return (Just nsname)
                                           else (liftM $ ((nsname <> "::") <>)) <$>
                                                  nsidToFriendlyName' nsid target))
        Nothing allNS

-- Utility functions for working with L2 models...
-- | Fetch the current L2 model out of the state.