from typing import List
from typing import Dict
from typing import Set


def scope2dict(scopes: List[str]) -> Dict[str, Set]:
    """Given a list of scopes like ["admin:write", "user:read"]
    it will returns a dictionary where the namespace is the key and the actions
    turns into a set"""
    permissions: Dict[str, Set] = {}
    for s in scopes:
        try:
            ns, action = s.split(":", maxsplit=1)
        except ValueError:
            ns = s
            action = "any"
        ns = ns if ns else "any"
        actions = {a for a in action.split(":")}
        permissions[ns] = actions
    return permissions