def get_variant_name(nm, prevs):
    """Create a name starting at nm, to avoid any of the prevs."""
    if nm not in prevs:
        return nm

    i = 1
    while True:
        if nm + str(i) not in prevs:
            return nm + str(i)
        i += 1