def hrn_to_urn(hrn, type=None):
    # if  this is already a urn dont do anything 
    if not hrn or hrn.startswith(URN_PREFIX):
        return hrn

    authority = get_authority(hrn)
    name = get_leaf(hrn)
     
    if type == 'authority':
        authority = hrn
        name = 'sa'   
    
    if authority.startswith("plc"):
        if type == None:
            urn = "+".join(['',authority.replace('.',':'),name])
        else:
            urn = "+".join(['',authority.replace('.',':'),type,name])

    else:
        urn = "+".join(['',authority,type,name])
        
    return URN_PREFIX + urn
convert an hrn and type to a urn string
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/sfa/util/namespace.py/hrn_to_urn