import inspect


def clsname(obj):
    """Get objects class name.

    Args:
        obj (:obj:`object`):
            The object or class to get the name of.

    Returns:
        (:obj:`str`)

    """
    if inspect.isclass(obj) or obj.__module__ in ["builtins", "__builtin__"]:
        return obj.__name__
    return obj.__class__.__name__