def _find_fuse_next(working_list, homology, tm):
    '''Find the next sequence to fuse, and fuse it (or raise exception).

    :param homology: length of terminal homology in bp
    :type homology: int
    :raises: AmbiguousGibsonError if there is more than one way for the
             fragment ends to combine.
             GibsonOverlapError if no homology match can be found.

    '''
    # 1. Take the first sequence and find all matches
    # Get graphs:
    #   a) pattern watson : targets watson
    #   b) pattern watson : targets crick
    #   c) pattern crick: targets watson
    #   d) pattern crick: targets crick
    pattern = working_list[0]
    targets = working_list[1:]

    # Output graph nodes of terminal binders:
    #   (destination, size, strand1, strand2)
    def graph_strands(strand1, strand2):
        graph = []
        for i, target in enumerate(targets):
            matchlen = homology_report(pattern, target, strand1, strand2,
                                       cutoff=homology, min_tm=tm)
            if matchlen:
                graph.append((i, matchlen, strand1, strand2))
        return graph

    graph_ww = graph_strands('w', 'w')
    graph_wc = graph_strands('w', 'c')
    graph_cw = graph_strands('c', 'w')
    graph_cc = graph_strands('c', 'c')
    graphs_w = graph_ww + graph_wc
    graphs_c = graph_cw + graph_cc
    graphs = graphs_w + graphs_c

    # 2. See if there's more than one result on a strand.
    # If so, throw an exception.
    if len(graphs_w) > 1 or len(graphs_c) > 1:
        raise AmbiguousGibsonError('multiple compatible ends.')
    if len(graphs_w) == len(graphs_c) == 0:
        raise GibsonOverlapError('Failed to find compatible Gibson ends.')

    # 3. There must be one result. Where is it?
    # If there's one result on each strand, go with the one that matches the
    # pattern watson strand (will occur first - index 0)
    match = graphs[0]

    # 4. Combine pieces together
    # 4a. Orient pattern sequence
    if match[2] == 'c':
        left_side = pattern.reverse_complement()
    else:
        left_side = pattern
    # 4b. Orient target sequence
    if match[3] == 'w':
        right_side = working_list.pop(match[0] + 1).reverse_complement()
    else:
        right_side = working_list.pop(match[0] + 1)

    working_list[0] = left_side + right_side[match[1]:]
    return working_list
Find the next sequence to fuse, and fuse it (or raise exception).

    :param homology: length of terminal homology in bp
    :type homology: int
    :raises: AmbiguousGibsonError if there is more than one way for the
             fragment ends to combine.
             GibsonOverlapError if no homology match can be found.