When I compile the Python code below, I get
IndentationError: unindent does not match any outer indentation level
I was using Jupyter notebook and tried almost all of the above solutions (adapting to my scenario) to no use. I then went line by line, deleted all spaces for each line and replaced with tab. That solved the issue.