def get_can_use_permission(request, permission, permittee,
                           target_obj_or_class, redirect_to=None):
    """Get the 'can_use_aggregate' permission.
    
    For project, slice, or user permittees, call the corresponding
    add_to_* method of the target aggregate.
    """
    assert(isinstance(target_obj_or_class, Aggregate))
    assert(
        isinstance(permittee, User) or
        isinstance(permittee, Project) or
        isinstance(permittee, Slice)
    )
    assert(permission.name != "can_use_aggregate")

    aggregate = target_obj_or_class
    
    try:
        next = request.session["breadcrumbs"][-1][1]
    except IndexError:
        next = redirect_to or reverse("home")
    
    if isinstance(permittee, Project):
        return HttpResponseRedirect(
            aggregate.as_leaf_class().add_to_project(permittee, next))
    elif isinstance(permittee, Slice):
        return HttpResponseRedirect(
            aggregate.as_leaf_class().add_to_slice(permittee, next))
    else: # isinstance(permittee, User)
        return HttpResponseRedirect(
            aggregate.as_leaf_class().add_to_user(permittee, next))
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/aggregate/views.py/get_can_use_permission/operator `==` -> `!=`