added Python version (slowly replacing the C++ version :P )