'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)
            if (sys.version_info[:2] == (2, 7)):
                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(_checkLevel(level))
                        except StandardError 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 StandardError 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 StandardError 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 StandardError 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 StandardError as e:
                    raise ValueError(('Unable    to    configure    filter    %r:    %s' % (name, e)))
            handlers = config.get('handlers', EMPTY_DICT)
            for name in sorted(handlers):
                try:
                    handler = self.configure_handler(handlers[name])
                    handler.name = name
                    handlers[name] = handler
                except StandardError as e:
                    raise ValueError(('Unable    to    configure    handler    %r:    %s' % (name, e)))
            root = logging.root
            existing = 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)
                    prefixed = (name + '.')
                    pflen = len(prefixed)
                    num_existing = len(existing)
                    i = (i + 1)
                    while ((i < num_existing) and (existing[i][:pflen] == prefixed)):
                        child_loggers.append(existing[i])
                        i = (i + 1)
                    existing.remove(name)
                try:
                    self.configure_logger(name, loggers[name])
                except StandardError as e:
                    raise ValueError(('Unable    to    configure    logger    %r:    %s' % (name, e)))
            for log in existing:
                logger = root.manager.loggerDict[log]
                if (log in child_loggers):
                    logger.level = logging.NOTSET
                    logger.handlers = []
                    logger.propagate = True
                elif disable_existing:
                    logger.disabled = True
            root = config.get('root', None)
            if root:
                try:
                    self.configure_root(root)
                except StandardError as e:
                    raise ValueError(('Unable    to    configure    root    logger:    %s' % e))
    finally:
        logging._releaseLock()
