'Get a specific extension of the certificate by index.
:param index: The index of the extension to retrieve.
:return: The X509Extension object at the specified index.'

def get_extension(self, index):

    ext = X509Extension.__new__(X509Extension)
    ext._extension = _lib.X509_get_ext(self._x509, index)
    if (ext._extension == _ffi.NULL):
        raise IndexError('extension    index    out    of    bounds')
    extension = _lib.X509_EXTENSION_dup(ext._extension)
    ext._extension = _ffi.gc(extension, _lib.X509_EXTENSION_free)
    return ext
