Python code for QRAM