'Update config, or partial config, for a domain.
:param domain_id: the domain in question
:param config: the config dict containing and groups/options being
updated
:param group: an optional specific group of options, which if specified
must appear in config, with no other groups
:param option: an optional specific option within the group, which if
specified must appear in config, with no other options
The contents of the supplied config will be merged with the existing
config for this domain, updating or creating new options if these did
not previously exist. If group or option is specified, then the update
will be limited to those specified items and the inclusion of other
options in the supplied config will raise an exception, as will the
situation when those options do not already exist in the current
config.
:returns: a dict of groups containing all whitelisted options
:raises keystone.exception.InvalidDomainConfig: when the config
and group/option parameters specify an option we do not
support or one that does not exist in the original config'

def update_config(self, domain_id, config, group=None, option=None):

    def _assert_valid_update(domain_id, config, group=None, option=None):
        'Ensure    the    combination    of    config,    group    and    option    is    valid.'
        self._assert_valid_config(config)
        self._assert_valid_group_and_option(group, option)
        if group:
            if ((len(config) != 1) or (option and (len(config[group]) != 1))):
                if option:
                    msg = (_('Trying    to    update    option    %(option)s    in    group    %(group)s,    so    that,    and    only    that,    option    must    be    specified        in    the    config') % {'group': group, 'option': option})
                else:
                    msg = (_('Trying    to    update    group    %(group)s,    so    that,    and    only    that,    group    must    be    specified    in    the    config') % {'group': group})
                raise exception.InvalidDomainConfig(reason=msg)
            if (group not in config):
                msg = (_('request    to    update    group    %(group)s,    but    config    provided    contains    group    %(group_other)s    instead') % {'group': group, 'group_other': list(config.keys())[0]})
                raise exception.InvalidDomainConfig(reason=msg)
            if (option and (option not in config[group])):
                msg = (_('Trying    to    update    option    %(option)s    in    group    %(group)s,    but    config    provided    contains    option    %(option_other)s    instead') % {'group': group, 'option': option, 'option_other': list(config[group].keys())[0]})
                raise exception.InvalidDomainConfig(reason=msg)
            if (not self._get_config_with_sensitive_info(domain_id, group, option)):
                if option:
                    msg = (_('option    %(option)s    in    group    %(group)s') % {'group': group, 'option': option})
                    raise exception.DomainConfigNotFound(domain_id=domain_id, group_or_option=msg)
                else:
                    msg = (_('group    %(group)s') % {'group': group})
                    raise exception.DomainConfigNotFound(domain_id=domain_id, group_or_option=msg)
    update_config = config
    if (group and option):
        update_config = {group: config}
    _assert_valid_update(domain_id, update_config, group, option)
    option_list = self._config_to_list(update_config)
    self.update_config_options(domain_id, option_list)
    self.get_config_with_sensitive_info.invalidate(self, domain_id)
    return self.get_config(domain_id)
