@classmethod
def get_namespace(cls, target, path):
    """Return a namespace with given target and path, create if needed."""
    path_, namespaces = cls.__get_helper(target, path)
    try:
        return namespaces[path_]
    except KeyError:
        if len(path) == 1:
            parent = {}
        else:
            parent = cls.get_namespace(target, path[:-1])
        return namespaces.setdefault(path_, cls.premake(path[-1], parent))
