# Buggy code
def _merge(self, matches):
    # get matches up to and including first important_match
    #   but if no important_match, then all matches are important_matches
    relevant_matches = self._first_important_matches(matches)

    # mapkeys with important matches
    def key_is_important(match, key):
        return match.valueflags(self).get(key) is ParameterFlag.final

    important_maps = tuple(
        dict(
            (k, v)
            for k, v in iteritems(match.value(self))
            if key_is_important(match, k)
        )
        for match in relevant_matches
    )
    # dump all matches in a dict
    # then overwrite with important matches
    return merge(
        concatv((m.value(self) for m in relevant_matches), reversed(important_maps))
    )


# Traceback (AttributeError)
`$ C:\Users\<username>\AppData\Local\Continuum\Anaconda3\Scripts\conda-script.py updat
e`

Traceback (most recent call last):
File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co
nda\exceptions.py", line 573, in conda_exception_handler
return_value = func(*args, **kwargs)
File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co
nda\cli\main.py", line 134, in _main
exit_code = args.func(args, p)
File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co
nda\cli\main_update.py", line 65, in execute
install(args, parser, 'update')
File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co
nda\cli\install.py", line 130, in install
context.validate_configuration()
File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co
nda\common\configuration.py", line 838, in validate_configuration
raise_errors(tuple(chain.from_iterable((errors, post_errors))))
File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co
nda\common\configuration.py", line 836, in <genexpr>
for name in self.parameter_names)
File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co
nda\common\configuration.py", line 829, in _collect_validation_error
func(*args, **kwargs)
File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co
nda\common\configuration.py", line 447, in __get__
result = typify_data_structure(self._merge(matches) if matches else self
.default,
File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co
nda\common\configuration.py", line 664, in _merge
for match in relevant_matches)
File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co
nda\common\configuration.py", line 664, in <genexpr>
for match in relevant_matches)
File "C:\Users\<username>\AppData\Local\Continuum\Anaconda3\lib\site-packages\co
nda\common\compat.py", line 71, in iteritems
return iter(d.items(**kw))
AttributeError: 'str' object has no attribute 'items'

# Fixed code
def _merge(self, matches):
    # get matches up to and including first important_match
    #   but if no important_match, then all matches are important_matches
    relevant_matches_and_values = tuple(
        (match, match.value(self)) for match in self._first_important_matches(matches)
    )
    for match, value in relevant_matches_and_values:
        if not isinstance(value, Mapping):
            raise InvalidTypeError(
                self.name,
                value,
                match.source,
                value.__class__.__name__,
                self._type.__name__,
            )

    # mapkeys with important matches
    def key_is_important(match, key):
        return match.valueflags(self).get(key) is ParameterFlag.final

    important_maps = tuple(
        dict((k, v) for k, v in iteritems(match_value) if key_is_important(match, k))
        for match, match_value in relevant_matches_and_values
    )
    # dump all matches in a dict
    # then overwrite with important matches
    return merge(
        concatv((v for _, v in relevant_matches_and_values), reversed(important_maps))
    )