code: def set(self, host, **kwargs):
          
          self.__check_host_args(host, kwargs)
  
          def update_line(key, value):
              """Produce new config line"""
              return "  %s %s" % (key, value)
  
          for key, values in kwargs.items():
              if type(values) not in [list, tuple]:  # pylint: disable=unidiomatic-typecheck
                  values = [values]
  
              lower_key = key.lower()
              update_idx = [idx for idx, x in enumerate(self.lines_)
                            if x.host == host and x.key.lower() == lower_key]
              extra_remove = []
              for idx in update_idx:
                  if values:  # values available, update the line
                      value = values.pop()
                      self.lines_[idx].line = update_line(self.lines_[idx].key, value)
                      self.lines_[idx].value = value
                  else:                # no more values available, remove the line
                      extra_remove.append(idx)
  
              for idx in reversed(sorted(extra_remove)):
                  del self.lines_[idx]
  
              if values:
                  mapped_key = _remap_key(key)
                  max_idx = max([idx for idx, line in enumerate(self.lines_) if line.host == host])
                  for value in values:
                      self.lines_.insert(max_idx + 1, ConfigLine(line=update_line(mapped_key, value),
                                                                 host=host, key=mapped_key,
                                                                 value=value))
docs: 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