How to load XDMF in Dolfinx 0.9.0?

I am trying to load a Fenics-generated XDMF file in Fenics. The code is:

def load_solution(xdmf_file):
    with XDMFFile(MPI.COMM_WORLD, xdmf_file, "r") as f:
        mesh = f.read_mesh()
        V = fem.functionspace(mesh, ("Lagrange", 1))
        u = fem.Function(V)
        f.read(u, "u_sol")
    return mesh, u

However, I get various errors along the lines of:

AttributeError: 'XDMFFile' object has no attribute 'read'

I have tried about 5-6 different API call versions (read, read_function, f.read_function, io.read_function) but none of them exist in this particular FenicsX install. Is there a way to load XDMF files in 0.9.0?

The XDMF was generated like this:

    name = f"advection-reaction-diffusion-steady-2d-{str(i)}.xdmf"
    with io.XDMFFile(dom.comm, name, "w") as xdmf:
        xdmf.write_mesh(dom)
        xdmf.write_function(u_sol)

where dom is a unit square mesh.

As far as I know, in DOLFINx 0.9.0 there is no read_function or similar API for reading a function directly from an XDMF file. It is also not listed in the official XDMFFile API documentation here:
(dolfinx.cpp.io — DOLFINx 0.9.0 documentation)
However you can look at (GitHub - jorgensd/adios4dolfinx: Extending DOLFINx with checkpointing functionality · GitHub). I noticed there are functions for reading function but personally i have not used it. Hope it may help.

Futhermore, I’ve evolved ADIOS4DOLFINx to be able to read in first order Lagrange data in io4dolfinx:
https://scientificcomputing.github.io/io4dolfinx

where you can call

input_file = "test.xdmf"
in_grid = io4dolfinx.read_mesh(input_file, MPI.COMM_WORLD, backend="xdmf")
u = io4dolfinx.read_point_data(input_file, "u", in_grid, backend="xdmf")