Converter from GMSH to XDMF (with physical groups)

Please follow the community guidelines and submit a minimal working code example: Read before posting: How do I get my question answered?
There are plenty of tutorials on how to convert an msh file to an xdmf file, see for instance:
Mesh generation and conversion with GMSH and PYGMSH | Jørgen S. Dokken