-
- # We have to do the following conversion
- # '\\.' -> '.' # where '.' belongs in the urn name
- # '.' -> ':" # where ':' is the urn hierarchy delimiter
- # by doing the following
- # 1. split authority around '\\.'
- # 2. replace '.' with ':' in all parts
- # 3. join parts around '.'
- parts = authority.split('\\.')
- authority = '.'.join([part.replace('.', ':') for part in parts])
+
+ # convert from hierarchy delimiter from '.' to ':'
+ authority = re.sub(r'([a-zA-Z0-9])[\.]', r'\1:', authority)
+ # unescape escaped characters
+ authority = re.sub(r'\\(.)', r'\1', authority)