def add_suffix_if_exists(candidate, existing_names, suffix_patt="_v{}"):
    """ Append a auto-incrementing suffix to a candidate name as long as the
    candidate name is in the existing names.

    Parameters
    ----------
    candidate : str
        Candidate name to add a suffix to if present in the existing names.

    existing_names : list(str)
        List of names that the output path cannot be.

    suffix_patt : str
        String containing {} that will be used to build and auto-incrementing
        suffix (using str.format).

    Returns
    -------
    str
        New name, not present in existing_names.
    """
    i = 1
    while candidate in existing_names:
        if i > 1:
            # Remove the previous suffix
            old_suffix = suffix_patt.format(i)
            candidate = candidate[:-len(old_suffix)]

        i += 1
        new_suffix = suffix_patt.format(i)
        candidate += new_suffix

    return candidate