'Fetch chain for certificate.
:param .CertificateResource certr: Certificate Resource
:param int max_length: Maximum allowed length of the chain.
Note that each element in the certificate requires new
``HTTP GET`` request, and the length of the chain is
controlled by the ACME CA.
:raises errors.Error: if recursion exceeds `max_length`
:returns: Certificate chain for the Certificate Resource. It is
a list ordered so that the first element is a signer of the
certificate from Certificate Resource. Will be empty if
``cert_chain_uri`` is ``None``.
:rtype: `list` of `OpenSSL.crypto.X509` wrapped in `.ComparableX509`'

def fetch_chain(self, certr, max_length=10):

    chain = []
    uri = certr.cert_chain_uri
    while ((uri is not None) and (len(chain) < max_length)):
        (response, cert) = self._get_cert(uri)
        uri = response.links.get('up', {}).get('url')
        chain.append(cert)
    if (uri is not None):
        raise errors.Error("Recursion    limit    reached.    Didn't    get    {0}".format(uri))
    return chain
