def _toggle_selected(selected_data, value):
    """Add or remove value from the selected data set.

    Parameters
    ----------
    selected_data : set
        Set of selected data points to be modified.
    value : int
        Index of point to add or remove from selected data set.

    Returns
    -------
    set
        Modified selected_data set.
    """
    if value in selected_data:
        selected_data.remove(value)
    else:
        selected_data.add(value)

    return selected_data