def jaccard_index(set1, set2, remove_subset=True):
    """
    Computes the similarity between two sets.
        https://en.wikipedia.org/wiki/Jaccard_index

    Parameters
    ----------
    set1 : set
    set2 : set
    remove_subset : bool
        If a set is a subset of the other, return 1.


    Returns
    -------
    index : float


    References
    ----------
    .. [1] `Wikipedia entry for the Jaccard index
           <https://en.wikipedia.org/wiki/Jaccard_index>`_
    """
    union = len(set1.union(set2))
    max_size = max(len(set1), len(set2))
    if union == max_size and remove_subset:
        return 1.0
    return float(len(set1.intersection(set2))) / float(union)
