Python Fit Multivariate Functions