from typing import Union
from typing import Type
from typing import Callable


def fqn(obj: Union[Type, Callable]) -> str:
    """Return the fully qualified name of an object, str() as fallback."""
    module = obj.__module__ + '.' if hasattr(obj, '__module__') else ''
    name = obj.__qualname__ if hasattr(obj, '__qualname__') else str(obj)
    return module + name