def _IsRemoteBetter(new_name, old_name):
  """Indicates if a new remote is better than an old one, based on remote name.

  Names are ranked as follows: If either name is "origin", it is considered
  best, otherwise the name that comes last alphabetically is considered best.

  The alphabetical ordering is arbitrary, but it was chosen because it is
  stable. We prefer "origin" because it is the standard name for the origin
  of cloned repos.

  Args:
    new_name: The name to be evaluated.
    old_name: The name to compare against.
  Returns:
    True iff new_name should replace old_name.
  """
  if not new_name or old_name == 'origin':
    return False
  if not old_name or new_name == 'origin':
    return True
  return new_name > old_name