For a supplied connected component (which is assumed to be a deepcopy from an original breakpoint graph)
    we filter out all edges, that are of no interest for the scaffolding purposes with current target multicolor:
        1. target multicolor must be fully present in the irregular edge
        2. all colors from the target multicolor must be present exactly once in irregular edge multicolor
        3. no colors from the "exclude" set must be present in the irregular edge multicolor
        4. regular edge must "support" two irregular edges, that have survived the filtration specified above

def get_irregular_subnets(cc, target_multicolor, exclude, verbose=False, verbose_destination=None):
    """
    For a supplied connected component (which is assumed to be a deepcopy from an original breakpoint graph)
    we filter out all edges, that are of no interest for the scaffolding purposes with current target multicolor:
        1. target multicolor must be fully present in the irregular edge
        2. all colors from the target multicolor must be present exactly once in irregular edge multicolor
        3. no colors from the "exclude" set must be present in the irregular edge multicolor
        4. regular edge must "support" two irregular edges, that have survived the filtration specified above
    """
    to_remove = []

    if verbose:
        print(">Getting irregular subnets", file=verbose_destination)
        print("Graph contains", len(list(cc.edges())), "edges", file=verbose_destination)
        print("Removing uninteresting irregular edges", file=verbose_destination)

    ####################################################################################################
    # we work with a supplied connected components,
    #   assuming that its a deepcopy of the connected components in the original graph
    # so we can do with it whatever we want, without affecting data in the original graph
    ####################################################################################################
    for bgedge, key in cc.edges(keys=True):
        ####################################################################################################
        # infinity edges must fully contain target multicolor
        ####################################################################################################
        if bgedge.is_irregular_edge and not target_multicolor <= bgedge.multicolor:
            if verbose:
                print("  removing", bgedge.vertex1.name, "--", bgedge.vertex2.name,
                      [color.name for color in bgedge.multicolor.multicolors.elements()], ": no target multicolor",
                      file=verbose_destination)
            to_remove.append((bgedge, key))
            continue
        ####################################################################################################
        # infinity edges must not contain colors from the excluded group
        ####################################################################################################
        if bgedge.is_irregular_edge and any(map(lambda color: color in bgedge.multicolor.colors, exclude)):
            if verbose:
                print("  removing", bgedge.vertex1.name, "--", bgedge.vertex2.name,
                      [color.name for color in bgedge.multicolor.multicolors.elements()],
                      ": contains exclude multicolor", file=verbose_destination)
            to_remove.append((bgedge, key))
            continue
        ####################################################################################################
        # in infinity edge multicolor all colors from targetted multicolor must have multiplicity one
        ####################################################################################################
        if bgedge.is_irregular_edge and any(map(lambda color: bgedge.multicolor.multicolors[color] > 1, target_multicolor.colors)):
            if verbose:
                print("  removing", bgedge.vertex1.name, "--", bgedge.vertex2.name,
                      [color.name for color in bgedge.multicolor.multicolors.elements()],
                      ": multicplicity of some target multicolor os greater than 1", file=verbose_destination)
            to_remove.append((bgedge, key))
            continue
            ####################################################################################################

    ##########################################################################################################
    # once we've gathered all uninteresting / ambiguous (from target multicolor scaffolding stand point) irregular edges
    #   we remove them
    ##########################################################################################################
    for bgedge, key in to_remove:
        cc.delete_bgedge(bgedge, key)
    if verbose:
        print("Graph contains", len(list(cc.edges())), "edges", file=verbose_destination)

    to_remove = []
    ################################################################################
    # after we have left only those infinity edges are of interesting for the scaffolding purposses
    # we filter regular edges to leave only those, that are supporting these infinity edges
    ################################################################################
    if verbose:
        print("Removing uninteresting regular edges", file=verbose_destination)
    for bgedge, key in cc.edges(keys=True):
        ################################################################################
        # we only need edges that are either infinity edges, that were left during the presious step
        # or support edges (have infinity edges at both vertices, that they are incident to)
        ################################################################################
        if not bgedge.is_irregular_edge and not supports_a_pair_of_irregular_edges(cc, bgedge):
            if verbose:
                print("  removing", bgedge.vertex1.name, "--", bgedge.vertex2.name,
                      [color.name for color in bgedge.multicolor.multicolors.elements()],
                      ": does not support any irregular edge", file=verbose_destination)
            to_remove.append((bgedge, key))

    ##########################################################################################################
    # once we've gathered all regular edges, that do not support pairs of interesting (from scaffolding stand point)
    #   irregular edges
    ##########################################################################################################
    for bgedge, key in to_remove:
        cc.delete_bgedge(bgedge, key)
    if verbose:
        print("Graph contains", len(list(cc.edges())), "edges", file=verbose_destination)

    ##########################################################################################################
    # once we've deleted all the uninteresting for scaffolding purposes infinity and regular edges,
    #   our connected component
    # is being torn apart into multiple connected components, each of which we can process independently
    # and which contain only edges of interest for us
    ##########################################################################################################
    result = []
    for cc in cc.connected_components_subgraphs(copy=False):
        if len(list(cc.edges())) > 0:
            result.append(cc)
    return result