I want to copy already indented Python code / whole functions and classes into IPython. Everytime I try the indentation is screwed up and I get following error message:
One of the useful answers was lost in the comments, so wanted to restate it along with adding a reference for another useful IPython magic function.
First to restate what @EOL said, one way to solve OP's problem is to turn off auto-indentation by first running %autoindent and doing the paste (not needed if you are using %paste, of course).
Now to add more information to what is already there here, one more useful mode in IPython is %doctest_mode which allows you to copy paste example and test snippets from doc strings. This is also useful to execute interactive python session output that you could find in documentation and online forums, without having to first strip out the prompt strings.