def get_user_for_response(id, request, include_products=True):
    id_type = unicode(request.args.get("id_type", "url_slug"))

    try:
        logged_in = unicode(getattr(current_user, id_type)) == id
    except __HOLE__:
        logged_in = False

    retrieved_user = get_profile_from_id(
        id,
        id_type,
        show_secrets=logged_in,
        include_products=include_products
    )

    if retrieved_user is None:
        logger.debug(u"in get_user_for_response, user {id} doesn't exist".format(
            id=id))
        abort(404, "That user doesn't exist.")

    g.profile_slug = retrieved_user.url_slug

    return retrieved_user
dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/views.py/get_user_for_response