python pathfinder implementation