def set(self, host, **kwargs):
self.__check_host_args(host, kwargs)<EOL>def update_line(key, value):<EOL><INDENT>"""<STR_LIT>"""<EOL>return "<STR_LIT>" % (key, value)<EOL><DEDENT>for key, values in kwargs.items():<EOL><INDENT>if type(values) not in [list, tuple]:  <EOL><INDENT>values = [values]<EOL><DEDENT>lower_key = key.lower()<EOL>update_idx = [idx for idx, x in enumerate(self.lines_)<EOL>if x.host == host and x.key.lower() == lower_key]<EOL>extra_remove = []<EOL>for idx in update_idx:<EOL><INDENT>if values:  <EOL><INDENT>value = values.pop()<EOL>self.lines_[idx].line = update_line(self.lines_[idx].key, value)<EOL>self.lines_[idx].value = value<EOL><DEDENT>else:                <EOL><INDENT>extra_remove.append(idx)<EOL><DEDENT><DEDENT>for idx in reversed(sorted(extra_remove)):<EOL><INDENT>del self.lines_[idx]<EOL><DEDENT>if values:<EOL><INDENT>mapped_key = _remap_key(key)<EOL>max_idx = max([idx for idx, line in enumerate(self.lines_) if line.host == host])<EOL>for value in values:<EOL><INDENT>self.lines_.insert(max_idx + <NUM_LIT:1>, ConfigLine(line=update_line(mapped_key, value),<EOL>host=host, key=mapped_key,<EOL>value=value))<EOL><DEDENT><DEDENT><DEDENT>
Set configuration values for an existing host.
Overwrites values for existing settings, or adds new settings.

Parameters
----------
host : the Host to modify.
**kwargs : The new configuration parameters