def validateURN(value):
    NID_PATTERN = re.compile('^[0-9a-z][0-9a-z-]{1,31}$', flags=re.IGNORECASE)
    NSS_PCHAR = "[a-z0-9-._~]|%[a-f0-9]{2}|[!$&'()*+,;=]|:|@"
    NSS_PATTERN = re.compile(f'^({NSS_PCHAR})({NSS_PCHAR}|/|\?)*$', re.IGNORECASE)
    prefix = value.split(':')
    if (len(prefix) < 3):
        current_app.logger.warning('Too small urn prefix')
        return False
    urn = prefix[0]
    nid = prefix[1]
    nss = value.replace((((urn + ':') + nid) + ':'), '')
    if (not (urn.lower() == 'urn')):
        current_app.logger.warning((urn + ' contains invalid characters '))
        return False
    if (not re.match(NID_PATTERN, nid.lower())):
        current_app.logger.warning((nid + ' contains invalid characters '))
        return False
    if (not re.match(NSS_PATTERN, nss)):
        current_app.logger.warning((nss + ' contains invalid characters '))
        return False
    return True
def validateURN(value):
    NID_PATTERN = re.compile('^[0-9a-z][0-9a-z-]{1,31}$', flags=re.IGNORECASE)
    NSS_PCHAR = "[a-z0-9-._~]|%[a-f0-9]{2}|[!$&'()*+,;=]|:|@"
    NSS_PATTERN = re.compile(f'^({NSS_PCHAR})({NSS_PCHAR}|/|\?)*$', re.IGNORECASE)
    prefix = value.split(':')
    if (len(prefix) < 3):
        current_app.logger.warning('Too small urn prefix')
        return False
    urn = prefix[0]
    nid = prefix[1]
    nss = value.replace((((urn + ':') + nid) + ':'), )
    if (not (urn.lower() == 'urn')):
        current_app.logger.warning((urn + ' contains invalid characters '))
        return False
    if (not re.match(NID_PATTERN, nid.lower())):
        current_app.logger.warning((nid + ' contains invalid characters '))
        return False
    if (not re.match(NSS_PATTERN, nss)):
        current_app.logger.warning((nss + ' contains invalid characters '))
        return False
    return True