def __get_state(self):
        "Get the state of this Namespace and any child Namespaces."
        state = {}
        for name, types in self.__static.items():
            box = state.setdefault(name, {})
            for type_, value in types.items():
                box[type_] = value.state if type_ is Namespace else value
        for name, value in self.__original.items():
            box = state.setdefault(name, {})
            if name in self.__dynamic:
                value = self.__dynamic[name]
            elif isinstance(value, Parameter):
                value = value.value
            else:
                box[Namespace] = value.state
                continue
            box.setdefault(Parameter, {})[type(value)] = value
        return state
Get the state of this Namespace and any child Namespaces.
recipes/Python/578195_Setting_Namespaces/recipe-578195.py