I’ve come up with various theories about why pasting into python doesn’t work, but finally, I discovered iPython’s %cpaste command.
%paste pastes content from your clipboard, but doesn’t work in a remote environment.
Enter %cpaste.
In [109]: %cpaste Pasting code; enter '--' alone on the line to stop. : print(Paste Stuff Here)
Enter — and the paste ends cleanly… amazing.