Automatically generated circuits after decomposition into native gates often have redundant single qubit gates, e.g., 5 single qubit rotations in a sequence. They can be compressed and simplified through e.g. ZYZ decomposition and result in much shorter circuits. Based on the single qubit decomposition method in https://github.com/qutip/qutip-qip/tree/master/src/qutip_qip/decompose, we can build a function that takes a circuit, optimizes it by reducing the number of single qubit gate and then return a shorter circuit.