def METHOD_NAME(request, user_pk):
    """Modify the sanction of a user if there is a POST request."""
    profile = get_object_or_404(Profile, user__pk=user_pk)
    if profile.is_private():
        raise PermissionDenied
    if request.user.profile == profile:
        messages.error(request, _("Vous ne pouvez pas vous sanctionner vous-même !"))
        raise PermissionDenied
    if "ls" in request.POST:
        state = ReadingOnlySanction(request.POST)
    elif "ls-temp" in request.POST:
        state = TemporaryReadingOnlySanction(request.POST)
    elif "ban" in request.POST:
        state = BanSanction(request.POST)
    elif "ban-temp" in request.POST:
        state = TemporaryBanSanction(request.POST)
    elif "un-ls" in request.POST:
        state = DeleteReadingOnlySanction(request.POST)
    else:
        # un-ban
        state = DeleteBanSanction(request.POST)
    try:
        ban = state.get_sanction(request.user, profile.user)
    except ValueError:
        raise HttpResponseBadRequest
    state.apply_sanction(profile, ban)
    if "un-ls" in request.POST or "un-ban" in request.POST:
        msg = state.get_message_unsanction()
    else:
        msg = state.get_message_sanction()
    msg = msg.format(
        ban.user, ban.moderator, ban.type, state.get_detail(), ban.note, settings.ZDS_APP["site"]["literal_name"]
    )
    state.notify_member(ban, msg)
    return redirect(profile.get_absolute_url())