import statsmodels.api as sm


def ols(X, y, constant=True):
    if constant:
        X = sm.add_constant(X)

    model = sm.OLS(y, X)

    result = model.fit()
    print(result.summary())

    return result, model
