def _fullname(obj):
    """Get the fully qualified class name of an object."""
    if isinstance(obj, str):
        return obj

    cls = obj.__class__
    module = cls.__module__
    if module == "builtins":  # no need for builtin prefix
        return cls.__qualname__
    return module + "." + cls.__qualname__