python implementation of distribution sweep. Had to see how it worked before I did it in C