':param typename: The name of the extension to create.
:type typename: :py:data:`str`
:param critical: A flag indicating whether this is a critical extension.
:param value: The value of the extension.
:type value: :py:data:`str`
:param subject: Optional X509 cert to use as subject.
:type subject: :py:class:`X509`
:param issuer: Optional X509 cert to use as issuer.
:type issuer: :py:class:`X509`
:return: The X509Extension object'

def __init__(self, type_name, critical, value, subject=None, issuer=None):

    ctx = _ffi.new('X509V3_CTX*')
    _lib.X509V3_set_ctx(ctx, _ffi.NULL, _ffi.NULL, _ffi.NULL, _ffi.NULL, 0)
    _lib.X509V3_set_ctx_nodb(ctx)
    if (issuer is not None):
        if (not isinstance(issuer, X509)):
            raise TypeError('issuer    must    be    an    X509    instance')
        ctx.issuer_cert = issuer._x509
    if (subject is not None):
        if (not isinstance(subject, X509)):
            raise TypeError('subject    must    be    an    X509    instance')
        ctx.subject_cert = subject._x509
    if critical:
        value = ('critical,' + value)
    extension = _lib.X509V3_EXT_nconf(_ffi.NULL, ctx, type_name, value)
    if (extension == _ffi.NULL):
        _raise_current_error()
    self._extension = _ffi.gc(extension, _lib.X509_EXTENSION_free)
