PRISM Python code