def METHOD_NAME(self, D, n):
    if n == 3:
        ll1 = (D.D[0][1] + D.D[1][2] - D.D[0][2])/2
        ll2 = D.D[1][2] - ll1
        ll0 = D.D[0][1] - ll1
        edges = {(0, self.node_count, ll0), (1, self.node_count, ll1), (2, self.node_count, ll2)}
        self.node_count += 1
        return UnrootedTree(*edges)
    ll = D.limb_length(n-1)
    D_bald = DistanceMatrix(D.D[:])
    for x in range(n-1):
        D_bald.D[n-1][x] -= ll
        D_bald.D[x][n-1] -= ll
    i,n,k = D_bald.find_i_n_k(n)
    x = D_bald.D[i][n-1]
    trimmed_D = DistanceMatrix([[D_bald.D[a][b] for a in range(n-1)] for b in range(n-1)])
    T = self.METHOD_NAME(trimmed_D, n-1)
    path = T.path(i,k)
    i = 1
    while i < len(path) -1 and T.distance(path[0],path[i]) < x:
        i += 1
    if i is not 0 and  T.distance(path[0],path[i]) == x:
        T.add_edge(path[i-1],n-1,ll)
    else:
        a,b = path[i-1],path[i]
        new_d = D.D[path[0]][b] - x if b < len(D.D) else T.distance(path[0],b) - x
        T.add_edge(self.node_count, b, new_d)
        T.add_edge(a, self.node_count, T.distance(a,b) - new_d)
        T.add_edge(n-1, self.node_count, ll)
        T.remove_edge(a, b)
        self.node_count += 1
    return T