def fq_typename(obj):
    """Returns the fully-qualified type name of an object.

    If the object is a type, returns its fully-qualified name.
    """
    typ = type(obj) if not isinstance(obj, type) else obj
    return '{}.{}'.format(typ.__module__, typ.__qualname__)