def pem_cert_validate(pem_str):
    """Validate a Certificate PEM string
    Returns
    True if valid form False otherwise
    """
    lines = pem_str.splitlines()
    if lines[0] != "-----BEGIN CERTIFICATE-----":
        return False
    elif lines[-1] != "-----END CERTIFICATE-----":
        return False
    if not re.match(r"[a-zA-Z0-9+/]={0,2}", "".join(lines[1:-1])):
        return False
    else:
        return True
Validate a Certificate PEM string
    Returns
    True if valid form False otherwise
    
app/certsynth.py