Python version of percolation