def _normalize_params(params):
 if (type(params) == dict):
  params = list(params.items())
 params = [(k, v) for (k, v) in params if (k not in ('oauth_signature', 'realm'))]
 params.sort()
 qs = parse.urlencode(params)
 qs = qs.replace('+', '%20')
 qs = qs.replace('%7E', '~')
 return qs

def _normalize_params ( params ) : if ( type ( params ) == dict ) : params = list ( params . items ( ) ) params = [ ( k , v ) for ( k , v ) in params if ( k not in ( 'oauth_signature' , 'realm' ) ) ] params . sort ( ) qs = parse . urlencode ( params ) qs = qs . replace ( '+' , '%20' ) qs = qs . replace ( '%7E' , '~' ) return qs
returns a normalized query string sorted first by key .