code: def append_index_id(id, ids):
      
      index = 1
      mod = '%s_%s' % (id, index)
      while mod in ids:
          index += 1
          mod = '%s_%s' % (id, index)
      ids.append(mod)
      return mod, ids
docs: add index to id to make it unique wrt ids