adding john's python code