copypasta from cryptography

I don't know what this does or why it works, but thanks @dreid for the suggestion.