Import config values from a dictionary.

        When ``as_defaults`` is set to ``True``, the values
        imported will be set as defaults. This can be used to
        declare the sections and items of configuration.
        Values of sections and items in ``dictionary`` can be
        dictionaries as well as instances of :class:`.Item` and
        :class:`.Config`.

        Args:
            dictionary:
            as_defaults: if ``True``, the imported values will be set as defaults.

def load_values(self, dictionary, as_defaults=False, flat=False):
        """
        Import config values from a dictionary.

        When ``as_defaults`` is set to ``True``, the values
        imported will be set as defaults. This can be used to
        declare the sections and items of configuration.
        Values of sections and items in ``dictionary`` can be
        dictionaries as well as instances of :class:`.Item` and
        :class:`.Config`.

        Args:
            dictionary:
            as_defaults: if ``True``, the imported values will be set as defaults.
        """
        if flat:
            # Deflatten the dictionary and then pass on to the normal case.
            separator = self.settings.str_path_separator
            flat_dictionary = dictionary
            dictionary = collections.OrderedDict()
            for k, v in flat_dictionary.items():
                k_parts = k.split(separator)
                c = dictionary
                for i, kp in enumerate(k_parts):
                    if i >= len(k_parts) - 1:
                        c[kp] = v
                    else:
                        if kp not in c:
                            c[kp] = collections.OrderedDict()
                        c = c[kp]

        for name, value in dictionary.items():
            if name not in self:
                if as_defaults:
                    if isinstance(value, dict):
                        self[name] = self.create_section()
                        self[name].load_values(value, as_defaults=as_defaults)
                    else:
                        self[name] = self.create_item(name, default=value)
                else:
                    # Skip unknown names if not interpreting dictionary as defaults
                    pass
                continue

            resolution = self._get_item_or_section(name, handle_not_found=False)
            if is_config_item(resolution):
                if as_defaults:
                    resolution.default = value
                else:
                    resolution.value = value
            else:
                resolution.load_values(value, as_defaults=as_defaults)