def find_unique_name(name, names, inc_format='{name}{count:03}', sanity_count=9999999):
    """
    Finds a unique name in a given set of names
    :param name: str, name to search for in the scene
    :param names: list<str>, set of strings to check for a unique name
    :param inc_format: str, used to increment the name
    :param sanity_count: int, used to prevent infinite search loop. Increment if needed (default=9999999)
    """

    count = 0
    ret = name
    while ret in names:
        count += 1
        ret = inc_format.format(name=name, count=count)
        if sanity_count and count > sanity_count:
            raise Exception('Unable to find a unique name in {} tries, try a different format.'.format(sanity_count))

    return ret