'Requires Flask-Login (https://pypi.python.org/pypi/Flask-Login/)
to be installed and setup.'

def get_user_info(self, request):

    if (not has_flask_login):
        return
    if (not hasattr(current_app, 'login_manager')):
        return
    try:
        is_authenticated = current_user.is_authenticated
    except AttributeError:
        return {}
    if callable(is_authenticated):
        is_authenticated = is_authenticated()
    if (not is_authenticated):
        return {}
    user_info = {'id': current_user.get_id()}
    if ('SENTRY_USER_ATTRS' in current_app.config):
        for attr in current_app.config['SENTRY_USER_ATTRS']:
            if hasattr(current_user, attr):
                user_info[attr] = getattr(current_user, attr)
    return user_info
