xyz's python code