A flexible zwitterion ligand based lanthanide metal-organic framework for luminescence sensing of metal ions and small molecules.