Cause every possible configuration sub-dictionary to exist.

    This is intended to be called very early in the configuration
    sequence.  For each module, it checks that the corresponding
    configuration item exists in `config` and creates it as an empty
    dictionary if required, and then recurses into child
    configs/modules.

    :param dict config: configuration to populate
    :param modules: modules or Configurable instances to use
    :type modules: iterable of :class:`~yakonfig.configurable.Configurable`
    :param str prefix: prefix name of the config
    :return: `config`
    :raises yakonfig.ConfigurationError: if an expected name is present
      in the provided config, but that name is not a dictionary

def create_config_tree(config, modules, prefix=''):
    '''Cause every possible configuration sub-dictionary to exist.

    This is intended to be called very early in the configuration
    sequence.  For each module, it checks that the corresponding
    configuration item exists in `config` and creates it as an empty
    dictionary if required, and then recurses into child
    configs/modules.

    :param dict config: configuration to populate
    :param modules: modules or Configurable instances to use
    :type modules: iterable of :class:`~yakonfig.configurable.Configurable`
    :param str prefix: prefix name of the config
    :return: `config`
    :raises yakonfig.ConfigurationError: if an expected name is present
      in the provided config, but that name is not a dictionary

    '''
    def work_in(parent_config, config_name, prefix, module):
        if config_name not in parent_config:
            # this is the usual, expected case
            parent_config[config_name] = {}
        elif not isinstance(parent_config[config_name], collections.Mapping):
            raise ConfigurationError(
                '{0} must be an object configuration'.format(prefix))
        else:
            # config_name is a pre-existing dictionary in parent_config
            pass

    _recurse_config(config, modules, work_in)