Two lessons: Dictionary comprehensions with items() give you access to both key and value for transformation.
Be careful when inverting. Duplicate values cause data loss. Original keys with the same value will overwrite each other. Inversion is useful for reverse lookups: if you have name-to-id, you might need id-to-name.