Least Square Fitting Python Code