Python: Potts model for 3d Volume with flexible regularizer