Adding minimize in python