Generalized DA stuff in Python (R?)