On this line, you call the function with (evals, S0) as a callable tuple, but on line 83 you created response exactly as this. Shouldn't it be reused for the function? It seems like response is unused afterwards and serve no purpose.