import inspect


def get_instance_user_attributes(cls):
    """
    Returns user attributes defined in a class or instance of a class
    :param cls:
    :return: list
    """

    _def_attrs = dir(type('dummy', (object,), {}))
    _def_attrs.extend(['staticMetaObject'])

    attributes = inspect.getmembers(cls, lambda a: not (inspect.isroutine(a)))
    attributes = [
        a for a in attributes if not (a[0].startswith('__') and a[0].endswith('__')) and a[0] not in _def_attrs]

    return attributes