def METHOD_NAME(dmodel, uh, dirichlet=None, solver='direct'):
    space = uh.space
    start = timer()
    A = dmodel.get_left_matrix()
    b = dmodel.get_right_vector()
    end = timer()
    print("Construct linear system time:", end - start)
    if dirichlet is not None:
        AD, b = dirichlet.apply(A, b, uh)
    else:
        AD = A
    if solver == 'cg':
        start = timer()
        D = AD.diagonal()
        M = spdiags(1/D, 0, AD.shape[0], AD.shape[1])
        uh[:], info = cg(AD, b, tol=1e-14, M=M)
        end = timer()
        print(info)
    elif solver == 'amg':
        start = timer()
        ml = pyamg.ruge_stuben_solver(AD)  
        uh[:] = ml.METHOD_NAME(b, tol=1e-12, accel='cg').reshape(-1)
        end = timer()
        print(ml)
    elif solver == 'direct':
        start = timer()
        uh[:] = spsolve(AD, b)
        end = timer()
    else:
        raise ValueError("We don't support solver `{}`! ".format(solver))
    print("Solve time:", end-start)
    return AD, b 