I'm surprised Paramiko lacks a higher level "load a key and detect which class it should be" - can you double check that if you didn't already? (And if you're feeling generous, I'd accept a PR over there to add such an API call.)