def get_query_string(p, new_params=None, remove=None):
 if (new_params is None):
  new_params = {}
 if (remove is None):
  remove = []
 for r in remove:
  for k in list(p):
   if (k == r):
    del p[k]
 for (k, v) in new_params.items():
  if ((k in p) and (v is None)):
   del p[k]
  elif (v is not None):
   p[k] = v
 return ('?' + '&'.join([(u'%s=%s' % (urlquote(k), urlquote(v))) for (k, v) in p.items()]))

def get_query_string ( p , new_params = None , remove = None ) : if ( new_params is None ) : new_params = { } if ( remove is None ) : remove = [ ] for r in remove : for k in list ( p ) : if ( k == r ) : del p [ k ] for ( k , v ) in new_params . items ( ) : if ( ( k in p ) and ( v is None ) ) : del p [ k ] elif ( v is not None ) : p [ k ] = v return ( '?' + '&' . join ( [ ( u'%s=%s' % ( urlquote ( k ) , urlquote ( v ) ) ) for ( k , v ) in p . items ( ) ] ) )
add and remove query parameters .