code: def set_extension(self, name, value):
          
  
          extension = x509.Extension({
              'extn_id': name
          })
          # We use native here to convert OIDs to meaningful names
          name = extension['extn_id'].native
  
          spec = extension.spec('extn_value')
  
          if not isinstance(value, spec) and value is not None:
              raise TypeError(_pretty_message(
                  '''
                  value must be an instance of %s, not %s
                  ''',
                  _type_name(spec),
                  _type_name(value)
              ))
  
          if name in self._special_extensions:
              setattr(self, '_%s' % name, value)
          else:
              if value is None:
                  if name in self._other_extensions:
                      del self._other_extensions[name]
              else:
                  self._other_extensions[name] = value
docs: Sets the value for an extension using a fully constructed Asn1Value
          object from asn1crypto. Normally this should not be needed, and the
          convenience attributes should be sufficient.
  
          See the definition of asn1crypto.x509.Extension to determine the
          appropriate object type for a given extension. Extensions are marked
          as critical when RFC5280 or RFC6960 indicate so. If an extension is
          validly marked as critical or not (such as certificate policies and
          extended key usage), this class will mark it as non-critical.
  
          :param name:
              A unicode string of an extension id name from
              asn1crypto.x509.ExtensionId
  
          :param value:
              A value object per the specs defined by asn1crypto.x509.Extension