Metal complexation in ionic liquids