python version of this, so that one can hope to use it somewhere else without rpy2...