def get_query_string(p, new_params=None, remove=None):
    """
    Add and remove query parameters. From `django.contrib.admin`.
    """

    if new_params is None:
        new_params = {}
    if remove is None:
        remove = []
    for r in remove:
        for k in list(p.keys()):
            #if k.startswith(r):
            if k == r:
                del p[k]
    for k, v in list(new_params.items()):
        if k in p and v is None:
            del p[k]
        elif v is not None:
            p[k] = v
    return '?' + '&'.join([(urlquote(k), urlquote(v)) % u'%s=%s' for k, v in p.items()])
dataset/ETHPy150Open stephenmcd/filebrowser-safe/filebrowser_safe/templatetags/fb_tags.py/get_query_string/swapped operands of `%`