python aic implementation