<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def next_redirect(request, fallback, **get_kwargs):
 """ Handle the "where should I go next?" part of comment views. The next value could be a the view modules for examples. Returns an ``HttpResponseRedirect``. """

    next = request.POST.get('next')
    if not is_safe_url(url=next, allowed_hosts=request.get_host()):
        next = resolve_url(fallback)

    if get_kwargs:
        if '#' in next:
            tmp = next.rsplit('#', 1)
            next = tmp[0]
            anchor = '#' + tmp[1]
        else:
            anchor = ''

        joiner = ('?' in next) and '&' or '?'
        next += joiner + urlencode(get_kwargs) + anchor
    return HttpResponseRedirect(next)