almost working for python