def list_attributes(obj):
    """
    Lists all attributes of an object or class

    :param obj: object or class
    :return: dictionary of user-defined attributes
    """
    return {k: v for k, v in vars(obj).items() if not k.startswith('__')}