<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wrap_query_params(func):
 """ A middleware that parses the urlencoded params from the querystring and attach it to the request `query_params` attribute. This middleware also merges the parsed value with the existing `params` attribute in same way as `wrap_form_params` is doing. """


    @functools.wraps(func)
    def wrapper(request, *args, **kwargs):
        params = {}
        for key, value in parse_qs(request.query_string.decode("utf-8")).items():
            if len(value) == 1:
                params[key] = value[0]
            else:
                params[key] = value

        request.params = merge_dicts(getattr(request, "params", None), params)
        request.query_params = params
        return func(request, *args, **kwargs)
    return wrapper