def jaccard(s1, s2):
    """
    Calculate the Jaccard *distance* between two sets (the length of the intersection / the length of the union). If
    either or both sets are empty the distance is 1.

    Note that this returns a distance -- 0 means things are similar, 1 means things are different

    :param s1: Set one
    :type s1: set
    :param s2: Set two
    :type s2: set
    :return: The Jaccard distance
    :rtype: float
    """

    if len(s1) == 0 or len(s2) == 0:
        return 1
    return 1 - 1.0 * len(s1.intersection(s2)) / len(s1.union(s2))