def add_infos(self, *keyvals, **kwargs):
    """Adds the given info and returns a dict composed of just this added info."""
    infos = dict(keyvals)
    kv_pairs = []
    for key, val in infos.items():
      key = key.strip()
      val = str(val).strip()
      if ':' in key:
        raise ValueError('info key "{}" must not contain a colon.'.format(key))
      kv_pairs.append((key, val))

    for k, v in kv_pairs:
      if k in self._info:
        raise ValueError('info key "{}" already exists with value {}. '
                         'Cannot add it again with value {}.'.format(k, self._info[k], v))
      self._info[k] = v

    try:
      with open(self._info_file, 'a') as outfile:
        for k, v in kv_pairs:
          outfile.write('{}: {}\n'.format(k, v))
    except __HOLE__:
      if not kwargs.get('ignore_errors', False):
        raise
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/base/run_info.py/RunInfo.add_infos