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: https://forums.swift.org/t/any-as-anyobject/11182
    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 https://github.com/apple/swift/blob/06b658c22ba7fff60d05176154ab4c16090389f3/stdlib/public/core/Misc.swift#L92
_typeName(MyType.self, qualified: true) == "MyModule.MyType"

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