Python code for QPSK modulator
Are you using scipy by any chance ?  

If yes , this might help 

https://scikit-dsp-comm.readthedocs.io/en/latest/_modules/sk_dsp_comm/digitalcom.html

check for functions "QPSK_tx"  and "QPSK_bb"