'Do the configuration.'

def configure(self):

    config = self.config
    if ('version' not in config):
        raise ValueError("dictionary    doesn't    specify    a    version")
    if (config['version'] != 1):
        raise ValueError(('Unsupported    version:    %s' % config['version']))
    incremental = config.pop('incremental', False)
    EMPTY_DICT = {}
    logging._acquireLock()
    try:
        if incremental:
            handlers = config.get('handlers', EMPTY_DICT)
            for name in handlers:
                if (name not in logging._handlers):
                    raise ValueError(('No    handler    found    with    name    %r' % name))
                else:
                    try:
                        handler = logging._handlers[name]
                        handler_config = handlers[name]
                        level = handler_config.get('level', None)
                        if level:
                            handler.setLevel(logging._checkLevel(level))
                    except Exception as e:
                        raise ValueError(('Unable    to    configure    handler    %r:    %s' % (name, e)))
            loggers = config.get('loggers', EMPTY_DICT)
            for name in loggers:
                try:
                    self.configure_logger(name, loggers[name], True)
                except Exception as e:
                    raise ValueError(('Unable    to    configure    logger    %r:    %s' % (name, e)))
            root = config.get('root', None)
            if root:
                try:
                    self.configure_root(root, True)
                except Exception as e:
                    raise ValueError(('Unable    to    configure    root    logger:    %s' % e))
        else:
            disable_existing = config.pop('disable_existing_loggers', True)
            logging._handlers.clear()
            del logging._handlerList[:]
            formatters = config.get('formatters', EMPTY_DICT)
            for name in formatters:
                try:
                    formatters[name] = self.configure_formatter(formatters[name])
                except Exception as e:
                    raise ValueError(('Unable    to    configure    formatter    %r:    %s' % (name, e)))
            filters = config.get('filters', EMPTY_DICT)
            for name in filters:
                try:
                    filters[name] = self.configure_filter(filters[name])
                except Exception as e:
                    raise ValueError(('Unable    to    configure    filter    %r:    %s' % (name, e)))
            handlers = config.get('handlers', EMPTY_DICT)
            deferred = []
            for name in sorted(handlers):
                try:
                    handler = self.configure_handler(handlers[name])
                    handler.name = name
                    handlers[name] = handler
                except Exception as e:
                    if ('target    not    configured    yet' in str(e)):
                        deferred.append(name)
                    else:
                        raise ValueError(('Unable    to    configure    handler    %r:    %s' % (name, e)))
            for name in deferred:
                try:
                    handler = self.configure_handler(handlers[name])
                    handler.name = name
                    handlers[name] = handler
                except Exception as e:
                    raise ValueError(('Unable    to    configure    handler    %r:    %s' % (name, e)))
            root = logging.root
            existing = list(root.manager.loggerDict.keys())
            existing.sort()
            child_loggers = []
            loggers = config.get('loggers', EMPTY_DICT)
            for name in loggers:
                if (name in existing):
                    i = (existing.index(name) + 1)
                    prefixed = (name + '.')
                    pflen = len(prefixed)
                    num_existing = len(existing)
                    while (i < num_existing):
                        if (existing[i][:pflen] == prefixed):
                            child_loggers.append(existing[i])
                        i += 1
                    existing.remove(name)
                try:
                    self.configure_logger(name, loggers[name])
                except Exception as e:
                    raise ValueError(('Unable    to    configure    logger    %r:    %s' % (name, e)))
            _handle_existing_loggers(existing, child_loggers, disable_existing)
            root = config.get('root', None)
            if root:
                try:
                    self.configure_root(root)
                except Exception as e:
                    raise ValueError(('Unable    to    configure    root    logger:    %s' % e))
    finally:
        logging._releaseLock()
