python implementation of univariate linear regression