'Return the reason of a Revoked object.
:return: The reason as a string'

def get_reason(self):

    extensions = self._revoked.extensions
    for i in range(_lib.sk_X509_EXTENSION_num(extensions)):
        ext = _lib.sk_X509_EXTENSION_value(extensions, i)
        if (_lib.OBJ_obj2nid(ext.object) == _lib.NID_crl_reason):
            bio = _new_mem_buf()
            print_result = _lib.X509V3_EXT_print(bio, ext, 0, 0)
            if (not print_result):
                print_result = _lib.M_ASN1_OCTET_STRING_print(bio, ext.value)
                if (print_result == 0):
                    _raise_current_error()
            return _bio_to_string(bio)
