def METHOD_NAME(perm_name, request, requires_org):
    if not requires_org:
        if perm_name not in ['requires_superuser', 'requires_owner_or_superuser_without_org']:
            raise AssertionError('requires_org=False can only be combined with requires_superuser or '
                                 'requires_owner_or_superuser_without_org')
        if request.user.is_superuser:
            return
        elif perm_name != 'requires_owner_or_superuser_without_org':
            return _make_resp('perm_denied')
    org_id = get_org_id(request)
    try:
        org = Organization.objects.get(pk=org_id)
    except Organization.DoesNotExist:
        return _make_resp('org_dne')
    # Skip perms checks if settings allow super_users to bypass.
    if request.user.is_superuser and ALLOW_SUPER_USER_PERMS:
        return
    try:
        org_user = OrganizationUser.objects.get(
            user=request.user, organization=org
        )
    except OrganizationUser.DoesNotExist:
        return _make_resp('user_dne')
    if not PERMS.get(perm_name, lambda x: False)(org_user):
        return _make_resp('perm_denied')