josh's python code