Picross solver in Python