<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def config_amend_(self,config_amend):
 """ This will take a YAML or dict configuration and load it into the configuration file for furthur usage. The good part about this method is that it doesn't clobber, only appends when keys are missing. This should provide a value in dictionary format like: { 'default': { 'togglsync': { 'dsn': 'sqlite:///zerp-toggl.db', 'default': { 'username': 'abced', 'toggl_api_key': 'arfarfarf', }, 'dev': { 'cache': False } } } OR at user's preference can also use yaml format: default: togglsync: dsn: 'sqlite:///zerp-toggl.db' default: username: 'abced' toggl_api_key: 'arfarfarf' dev: cache: False Then the code will append the key/values where they may be missing. If there is a conflict between a dict key and a value, this function will throw an exception. IMPORTANT: after making the change to the configuration, remember to save the changes with cfg.save_() """

        if not isinstance(config_amend,dict):
            config_amend = yaml.load(config_amend)

        def merge_dicts(source,target,breadcrumbs=None):
            """
            Function to update the configuration if required. Returns
            True if a change was made.
            """

            changed = False

            if breadcrumbs is None:
                breadcrumbs = []

            # Don't descend if we're not a dict
            if not isinstance(source,dict):
              return source

            # Let's start iterating over things
            for k,v in source.items():

                # New key, simply add.
                if k not in target:
                    target[k] = v
                    changed = True
                    continue

                # Not new key.... so is it a dict?
                elif isinstance(target[k],dict):
                    trail = breadcrumbs+[k]
                    if isinstance(v,dict):
                        if merge_dicts(v,target[k],trail):
                            changed = True
                    else:
                        raise Exception('.'.join(trail) + ' has conflicting dict/scalar types!')

                else:
                    trail = breadcrumbs+[k]
                    if isinstance(v,dict):
                        raise Exception('.'.join(trail) + ' has conflicting dict/scalar types!')

            return changed

        if merge_dicts(config_amend,self._cfg):
            self.overlay_load()

        return self._cfg