def allowed(request, file):
    try:
        addon = file.version.addon
    except __HOLE__:
        raise http.Http404

    # General case: addon is listed.
    if addon.is_listed:
        if ((addon.view_source and addon.status in amo.REVIEWED_STATUSES) or
                acl.check_addons_reviewer(request) or
                acl.check_addon_ownership(request, addon, viewer=True,
                                          dev=True)):
            return True  # Public and sources are visible, or reviewer.
        raise PermissionDenied  # Listed but not allowed.
    # Not listed? Needs an owner or an "unlisted" admin.
    else:
        if owner_or_unlisted_reviewer(request, addon):
            return True
    raise http.Http404  # Not listed, not owner or admin.
dataset/ETHPy150Open mozilla/addons-server/src/olympia/files/decorators.py/allowed