'Make sure that all names and titles in a list of fields are
unique, by appending numbers if necessary.'

@classmethod
def uniqify_names(cls, fields):

    unique = {}
    for field in fields:
        i = 2
        new_id = field.ID
        while (new_id in unique):
            new_id = (field.ID + u'_{:d}'.format(i))
            i += 1
        if (new_id != field.ID):
            vo_warn(W32, (field.ID, new_id), field._config, field._pos)
        field.ID = new_id
        unique[new_id] = field.ID
    for field in fields:
        i = 2
        if (field.name is None):
            new_name = field.ID
            implicit = True
        else:
            new_name = field.name
            implicit = False
        if (new_name != field.ID):
            while (new_name in unique):
                new_name = (field.name + u'    {:d}'.format(i))
                i += 1
        if ((not implicit) and (new_name != field.name)):
            vo_warn(W33, (field.name, new_name), field._config, field._pos)
        field._unique_name = new_name
        unique[new_name] = field.name
