def collect_parameters(uri_query=u'', body=[], headers=None, exclude_oauth_signature=True, with_realm=False):
 headers = (headers or {})
 params = []
 if uri_query:
  params.extend(urldecode(uri_query))
 if headers:
  headers_lower = dict(((k.lower(), v) for (k, v) in headers.items()))
  authorization_header = headers_lower.get(u'authorization')
  if (authorization_header is not None):
   params.extend([i for i in utils.parse_authorization_header(authorization_header) if (with_realm or (i[0] != u'realm'))])
 bodyparams = (extract_params(body) or [])
 params.extend(bodyparams)
 unescaped_params = []
 for (k, v) in params:
  if k.startswith(u'oauth_'):
   v = utils.unescape(v)
  unescaped_params.append((k, v))
 if exclude_oauth_signature:
  unescaped_params = list(filter((lambda i: (i[0] != u'oauth_signature')), unescaped_params))
 return unescaped_params

def collect_parameters ( uri_query = u'' , body = [ ] , headers = None , exclude_oauth_signature = True , with_realm = False ) : headers = ( headers or { } ) params = [ ] if uri_query : params . extend ( urldecode ( uri_query ) ) if headers : headers_lower = dict ( ( ( k . lower ( ) , v ) for ( k , v ) in headers . items ( ) ) ) authorization_header = headers_lower . get ( u'authorization' ) if ( authorization_header is not None ) : params . extend ( [ i for i in utils . parse_authorization_header ( authorization_header ) if ( with_realm or ( i [ 0 ] != u'realm' ) ) ] ) bodyparams = ( extract_params ( body ) or [ ] ) params . extend ( bodyparams ) unescaped_params = [ ] for ( k , v ) in params : if k . startswith ( u'oauth_' ) : v = utils . unescape ( v ) unescaped_params . append ( ( k , v ) ) if exclude_oauth_signature : unescaped_params = list ( filter ( ( lambda i : ( i [ 0 ] != u'oauth_signature' ) ) , unescaped_params ) ) return unescaped_params
replace parameters with a single shared variable .