def create_unique_name(prefix, names, separator='_'):

    i = 1

    name = prefix
    while name in names:
        name = prefix + separator + str(i)
        i += 1

    return name
Creates a name starting with 'prefix' that is not in 'names'.
dataset/ETHPy150Open enthought/traits/traits/util/resource.py/create_unique_name