Convert DER formated X.509 certificate to PEM formated

How do i convert DER formated X.509 certificate to PEM form using MbedTLS?
Actually the certificate which I’m receiving from server is in BASE64 encoded , while performing BASE64 decoding it gives DER formated certificate, but I require PEM format and want to covert the obtained DER format certificate to PEM using MbedTLS.

Could you please give an idea how to do this?

Thanks in advance