def nice_classname(obj):
if inspect.isclass(obj):<EOL><INDENT>cls_name = obj.__name__<EOL><DEDENT>else:<EOL><INDENT>cls_name = obj.__class__.__name__<EOL><DEDENT>mod = inspect.getmodule(obj)<EOL>if mod:<EOL><INDENT>name = mod.__name__<EOL>if name.startswith('<STR_LIT>'):<EOL><INDENT>name = name[len('<STR_LIT>'):]<EOL><DEDENT>return "<STR_LIT>" % (name, cls_name)<EOL><DEDENT>else:<EOL><INDENT>return cls_name<EOL><DEDENT>
Returns a nice name for class object or class instance.

        >>> nice_classname(Exception()) # doctest: +ELLIPSIS
        '...Exception'
        >>> nice_classname(Exception) # doctest: +ELLIPSIS
        '...Exception'