How to get class name in swift with module prefix

I would like to have a class name with a module prefix like we had with NSStringFromClass.
The problem of NSStringFromClass is that it mangles some classes names. So the first approach would be to use type(of:) but that doesnt has the module name. (I need the module name for backward compatibility). So far I came with the following:

func typeName(value: Any) -> String {
    let valueType  = type(of: value)
    var typeName = String(describing: valueType)
    //warning explanation:
    if valueType is AnyClass, let obj = value as? AnyObject {
        let typeObject : AnyObject.Type = type(of: obj)
        let objcTypeName = NSStringFromClass(typeObject)
        if objcTypeName.contains(substring: ".") {
            if let moduleName  = objcTypeName.components(separatedBy: ".").first {
                //we need to prefix the module name to the class name
                typeName = moduleName + "." + typeName
    return typeName

Any chance somebody can suggest a better approach with the current constrains I have?

Take a look at _typeName
_typeName(MyType.self, qualified: true) == "MyModule.MyType"

Thanks, I think I already saw it some time ago, _typeName looks like private method, no?