Yield message about inclusions inconsistancies

def inclusions_validation(tree:BubbleTree) -> iter:
    """Yield message about inclusions inconsistancies"""
    # search for powernode overlapping
    for one, two in it.combinations(tree.inclusions, 2):
        assert len(one) == len(one.strip())
        assert len(two) == len(two.strip())
        one_inc = set(included(one, tree.inclusions))
        two_inc = set(included(two, tree.inclusions))
        common_inc = one_inc & two_inc
        if len(common_inc) == one_inc:
            if not two in one_inc:
                yield ("ERROR inconsistency in inclusions: {} is both"
                       " included and not included in {}.".format(two, one))
        if len(common_inc) == two_inc:
            if not one in two_inc:
                yield ("ERROR inconsistency in inclusions: {} is both"
                       " included and not included in {}.".format(one, two))
        if len(common_inc) > 0:  # one and two are not disjoint
            if len(common_inc) == len(one_inc) or len(common_inc) == len(two_inc):
                # one is included in the other
                pass
            else:  # problem: some nodes are shared, but not all
                yield ("ERROR overlapping powernodes:"
                       " {} nodes are shared by {} and {},"
                       " which are not in inclusion."
                       " Shared nodes are {}".format(
                           len(common_inc), one, two, common_inc))
    for pwn in tree.powernodes():
        # search for empty powernodes
        if len(tree.inclusions[pwn]) == 0:
            yield ("WARNING empty powernode: {} is defined,"
                   " but contains nothing".format(pwn))
        # search for singleton powernodes
        if len(tree.inclusions[pwn]) == 1:
            yield ("WARNING singleton powernode: {} is defined,"
                   " but contains only {}".format(pwn, tree.inclusions[pwn]))
    # search for cycles
    nodes_in_cycles = utils.have_cycle(tree.inclusions)
    if nodes_in_cycles:
        yield ("ERROR inclusion cycle: the following {}"
               " nodes are involved: {}".format(
                   len(nodes_in_cycles), set(nodes_in_cycles)))