I have some reservation about this. The method is meant for the PROV model to normalise the literal it is parsing. Putting RDF-specific code here does not seem right.

In addition, the function checks for string literals and Literal instances, anything else (including URIRef) will be returned as-is. Therefore, unless I'm mistaken, I don't think the above code is necessary.