Weighted Least Squares Fitting Python