def ces_distance(C1, C2):
    """Return the distance between two cause-effect structures.

    Args:
        C1 (CauseEffectStructure): The first |CauseEffectStructure|.
        C2 (CauseEffectStructure): The second |CauseEffectStructure|.

    Returns:
        float: The distance between the two cause-effect structures in concept
        space.
    """
    if config.USE_SMALL_PHI_DIFFERENCE_FOR_CES_DISTANCE:
        return round(small_phi_ces_distance(C1, C2), config.PRECISION)

    concepts_only_in_C1 = [
        c1 for c1 in C1 if not any(c1.emd_eq(c2) for c2 in C2)]
    concepts_only_in_C2 = [
        c2 for c2 in C2 if not any(c2.emd_eq(c1) for c1 in C1)]
    # If the only difference in the CESs is that some concepts
    # disappeared, then we don't need to use the EMD.
    if not concepts_only_in_C1 or not concepts_only_in_C2:
        dist = _ces_distance_simple(C1, C2)
    else:
        dist = _ces_distance_emd(concepts_only_in_C1, concepts_only_in_C2)

    return round(dist, config.PRECISION)
Return the distance between two cause-effect structures.

    Args:
        C1 (CauseEffectStructure): The first |CauseEffectStructure|.
        C2 (CauseEffectStructure): The second |CauseEffectStructure|.

    Returns:
        float: The distance between the two cause-effect structures in concept
        space.