This is commented very aggressively for the benefit of new python programmers and those new to pathfinding algorithms. Others in the class I wrote this algorithm for found these comments very useful, and I hope you do as well.
Valuable resources I used while writing this: