def unparse_qs(qs, sort=False, reverse=False):
    """Reverse conversion for parse_qs"""
    result = []
    items = qs.items()
    if sort:
        items = sorted(items, key=lambda x: x[0], reverse=reverse)
    for keys, values in items:
        query_name = quote(keys)
        for value in values:
            result.append(query_name + "=" + quote(value))
    return "&".join(result)
def unparse_qs ( qs , sort = False , reverse = False ) : result = [ ] items = qs . items ( ) if sort : items = sorted ( items , key = lambda x : x [ 0 ] , reverse = reverse ) for keys , values in items : query_name = quote ( keys ) for value in values : result . append ( query_name + "=" + quote ( value ) ) return "&" . join ( result )
Reverse conversion for parse_qs