def add_params_to_qs(query, params):
 if isinstance(params, dict):
  params = params.items()
 queryparams = urlparse.parse_qsl(query, keep_blank_values=True)
 queryparams.extend(params)
 return urlencode(queryparams)

def add_params_to_qs ( query , params ) : if isinstance ( params , dict ) : params = params . items ( ) queryparams = urlparse . parse_qsl ( query , keep_blank_values = True ) queryparams . extend ( params ) return urlencode ( queryparams )
extend a query with a list of two-tuples .