def pairwise_merge(match):
    overhang = 8
    wa = match[0][0]
    wb = match[1][0]
    (bnda, bndb) = trace_overlap(*match)
    iscomplete = (lambda bnd, w: ((bnd[0] < overhang) and (bnd[1] >= (len(w) - overhang))))
    if (iscomplete(bnda, wa) or iscomplete(bndb, wb)):
        sa = wa.scores.sum()
        sb = wb.scores.sum()
        if (sa > sb):
            return (wa, None)
        else:
            return (None, wb)
    return (None, None)
def pairwise_merge(match):
    overhang = 8
    wa = match[0][0]
    wb = match[1][0]
    (bnda, bndb) = trace_overlap(*match)
    iscomplete = (lambda bnd, w: ((bnd[0] < overhang) and (bnd[1] >= (len(w) - overhang))))
    if (iscomplete(bnda, wa) or iscomplete(bndb, wb)):
        sa = wa.scores.sum()
        sb = wb.scores.sum()
        if (sa > sb):
            return (wa, None)
        else:
            return (None, wb)
    return (None, None)