'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)'

def __call__(self, config):

    ns_confs = {}
    for k in config:
        if ('.' in k):
            (ns, name) = k.split('.', 1)
            bucket = ns_confs.setdefault(ns, {})
            bucket[name] = config[k]
    for (ns, handler) in self.items():
        exit = getattr(handler, '__exit__', None)
        if exit:
            callable = handler.__enter__()
            no_exc = True
            try:
                for (k, v) in ns_confs.get(ns, {}).items():
                    callable(k, v)
            except:
                no_exc = False
                if (exit is None):
                    raise
                if (not exit(*sys.exc_info())):
                    raise
            finally:
                if (no_exc and exit):
                    exit(None, None, None)
        else:
            for (k, v) in ns_confs.get(ns, {}).items():
                handler(k, v)
