def __call__(self, config):
        """Iterate through config and pass it to each namespace handler.

        config
            A flat dict, where keys use dots to separate
            namespaces, and values are arbitrary.

        The first name in each config key is used to look up the
        corresponding namespace handler. For example, a config entry of
        {'tools.gzip.on': v} will call the 'tools' namespace handler
        with the args: ('gzip.on', v)
        """
        # Separate the given config into namespaces
        ns_confs = {}
        for k in config:
            if '.' in k:
                ns, name = k.split('.', 1)
                bucket = ns_confs.setdefault(ns, {})
                bucket[name] = config[k]

        # I chose __enter__ and __exit__ so someday this could be
        # rewritten using 'with' statement:
        # for ns, handler in self.items():
        #     with handler as callable:
        #         for k, v in ns_confs.get(ns, {}).items():
        #             callable(k, v)
        for ns, handler in self.items():
            exit = getattr(handler, '__exit__', None)
            if exit:
                callable = handler.__enter__()
                no_exc = True
                try:
                    try:
                        for k, v in ns_confs.get(ns, {}).items():
                            callable(k, v)
                    except Exception:
                        # The exceptional case is handled here
                        no_exc = False
                        if exit is None:
                            raise
                        if not exit(*sys.exc_info()):
                            raise
                        # The exception is swallowed if exit() returns true
                finally:
                    # The normal and non-local-goto cases are handled here
                    if no_exc and exit:
                        exit(None, None, None)
            else:
                for k, v in ns_confs.get(ns, {}).items():
                    handler(k, v)
Iterate through config and pass it to each namespace handler.

        config
            A flat dict, where keys use dots to separate
            namespaces, and values are arbitrary.

        The first name in each config key is used to look up the
        corresponding namespace handler. For example, a config entry of
        {'tools.gzip.on': v} will call the 'tools' namespace handler
        with the args: ('gzip.on', v)
        
cherrypy/lib/reprconf.py