<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def param_redirect(request, viewname, *args):
 """ Redirect and keep URL parameters if any. """

    url = reverse(viewname, PARAMS_URL_CONF, args)
    params = request.GET.urlencode().split('&')

    if hasattr(request, 'cparam'):
        for k, v in request.cparam.items():
            params.append('{0}={1}'.format(k, v))

    new_params = '&'.join(x for x in params if x != '')
    if len(new_params) > 0:
        return HttpResponseRedirect('{0}?{1}'.format(url, new_params))
    return HttpResponseRedirect(url)