Parse PEM-encoded X.509 certificate chain.

    Args:
        pem_data: str. PEM file retrieved from SignatureCertChainUrl.

    Returns:
        list or bool: If url is valid, returns the certificate chain as a list
            of cryptography.hazmat.backends.openssl.x509._Certificate
            certificates where certs[0] is the first certificate in the file; if
            url is invalid, returns False.

def _parse_pem_data(pem_data):
    """Parse PEM-encoded X.509 certificate chain.

    Args:
        pem_data: str. PEM file retrieved from SignatureCertChainUrl.

    Returns:
        list or bool: If url is valid, returns the certificate chain as a list
            of cryptography.hazmat.backends.openssl.x509._Certificate
            certificates where certs[0] is the first certificate in the file; if
            url is invalid, returns False.
    """
    sep = '-----BEGIN CERTIFICATE-----'
    cert_chain = [six.b(sep + s) for s in pem_data.split(sep)[1:]]
    certs = []
    load_cert = x509.load_pem_x509_certificate
    for cert in cert_chain:
        try:
            certs.append(load_cert(cert, default_backend()))
        except ValueError:
            warnings.warn('Certificate is invalid.')
            return False

    return certs