https://stackoverflow.com/questions/5833642/python-apns-sslerror
From within KeyChain export the following both in p12 format, without giving password:
Apple Development Push Servicescertificate ascert.p12primary keyunderApple Development Push Servicesaspkey.p12
In terminal go to the directory where you have exported the certificates and convert the p12 files to pem format and concatenate them as follows:
$ openssl pkcs12 -in pkey.p12 -out pkey.pem -nodes -clcerts
$ openssl pkcs12 -in cert.p12 -out cert.pem -nodes -clcerts
$ cat cert.pem pkey.pem > iphone_ck.pem