def delete_name(L, name, delete_following = False):
    """
    Remove all occurrences of name from any ballot in L.

    When used to remove undervotes, make sure double undervotes
    have already been handled (since following votes are then
    also eliminated).
    
    Args:
        L (list): list of ballots
        name (str): name of choice to be eliminated
        delete_following (bool): True if all following positions on ballot
            are also to be eliminated

    Returns:
        (list): list of possibly modified ballots

    Examples:
        >>> L = [('a', 'undervote', 'b'), ('undervote',), ('c',), ()]
        >>> delete_name(L, 'undervote')
        [('a', 'b'), (), ('c',), ()]
    """

    LL = []
    for ballot in L:
        if name in ballot:
            new_ballot = []
            for c in ballot:
                if c != name:
                    new_ballot.append(c)
                elif delete_following:
                    break
        else:
            new_ballot = ballot
        LL.append(tuple(new_ballot))

    return LL