def class_name(obj):
    """Fetch the class name of an object (class or instance).

    Another cosmetic shortcut.  The builtin way of getting an instance's class
    name is pretty disgusting (and long), accessing two hidden attributes in
    a row just feels wrong.

    :param any obj: The object you want the class name of
    :returns str: The class name

    """
    if isinstance(obj, type):
        # It's a class.
        return obj.__name__
    else:
        # It's an instance of a class.
        return obj.__class__.__name__