Returns a certificate object based on PEM text.

def _get_certificate_obj(cert):
    '''
    Returns a certificate object based on PEM text.
    '''
    if isinstance(cert, M2Crypto.X509.X509):
        return cert

    text = _text_or_file(cert)
    text = get_pem_entry(text, pem_type='CERTIFICATE')
    return M2Crypto.X509.load_cert_string(text)