Maximum Likelihood Estimation Python Code