[docs]defdeglose(tag:str):""" Return the namespace and tag separated in a 2-tuple :return: (namespace, tag) """namespace=tag.split("}")[0].replace("{","")tag=tag.split("}")[1]returnnamespace,tag
[docs]defclarkFromTuple(tuple:Tuple[str,str]):""" Generate a clark notaion from a tuple in the format (namespace, tag). It's also possible to pass a tuple form of only a tag element (tag) """iftuple[0]isNone:returnf"{tuple[1]}"returnf"{{{tuple[0]}}}{tuple[1]}"
[docs]defisClark(tag:str)->bool:""" Regex to check if a string is in the clark notation format """returnre.match("^\\{[a-zA-Z0-9:/#?=&;.]+?\\}[a-zA-Z_][a-zA-Z0-9_]*$",tag)isnotNone