Ionic liquids as solvents for rare-earth metals: a combined XAS and Molecular Dynamics study