construct sparse matrix python side
python scoping errors