def ensure_unique_index(index, indices, i=1):  # Indexed to 1 so +1 == 2nd, 3rd, 4th, etc. game
    """Check if index is in indices, modify index until it's unique, and return the unique index

    If the index is unique, it's returned as is. Otherwise, the function calls itself and increments i. The recursion
    stops when the index and numerical suffix (i) are not in indices. Used to create unique identifiers for multiple
    matchups between the same teams.

    Args:
        index: A string index to check for in indices
        indices: A list of indices to check the index against
        i: A numerical suffix used to modify index until it does not exist in indices
    Returns:
        index, or a modified form of index, that does not exist in indices
    """
    if index in indices:
        i = i+1
        test_index = "{}{}".format(index, i)
        if test_index in indices:
            return ensure_unique_index(index, indices, i)
        else:
            return test_index
    else:
        return index