def METHOD_NAME(extmesh, quadrilateral, testcase, tolerance):
    """Solve depth-independent H. problem on Pn x Pn and Pn x Real spaces"""
    family, degree = testcase
    mesh = extmesh(2, 2, 8, quadrilateral=quadrilateral)
    fspace = FunctionSpace(mesh, family, degree, vfamily="Real", vdegree=0)
    refspace = FunctionSpace(mesh, family, degree,
                             vfamily=family, vdegree=degree)
    sol_real = Function(fspace)
    sol_ref = Function(refspace)
    for s in [sol_real, sol_ref]:
        fs = s.function_space()
        u = TrialFunction(fs)
        v = TestFunction(fs)
        f = Function(fs)
        xyz = SpatialCoordinate(mesh)
        f.interpolate((1+8*pi*pi)*cos(2*pi*xyz[0])*cos(2*pi*xyz[1]))
        solve(inner(grad(u), grad(v))*dx + inner(u, v)*dx == inner(f, v)*dx, s)
    l2err = sqrt(assemble(inner((sol_real-sol_ref), (sol_real-sol_ref))*dx))
    assert abs(l2err) < tolerance