When pasting in a large class (>800 lines), it seems like IPython can lose track of the indentations and then will return an IndentationError:
In [1]: %paste
File "<tokenize>", line 772
(self.D['Department']==dept) &
^
IndentationError: unindent does not match any outer indentation level
Might be a memory or terminal overflow issue, but wanted to post here for reference since one can spend hours trying to track down tabs that don't exist and turn them into spaces. When you google or SO for IndentationError, "replace tabs with spaces" is literally the only solution. This obviously won't work in this case.
This is not a duplicate, it's a similar error but a very different issue.