def _get_unused_parameter_name(name, already_used_names):
  """Returns a string `name` different from all currently used names."""
  already_used_names = set(already_used_names)
  i = 1
  unique_name = name
  while unique_name in already_used_names:
    # Start at 0001 since the already-used bare `name` was implicitly 0000.
    unique_name = name + '_{:04d}'.format(i)
    i += 1
  return unique_name