def _nvp_dump(data):
 def escape(k, v):
  return ('%s=%s' % (k, urlquote(v)))
 out = []
 for (k, v) in sorted(data.items()):
  if isinstance(v, (list, tuple)):
   out.extend([escape(('%s(%s)' % (k, x)), v_) for (x, v_) in enumerate(v)])
  else:
   out.append(escape(k, v))
 return '&'.join(out)

def _nvp_dump ( data ) : def escape ( k , v ) : return ( '%s=%s' % ( k , urlquote ( v ) ) ) out = [ ] for ( k , v ) in sorted ( data . items ( ) ) : if isinstance ( v , ( list , tuple ) ) : out . extend ( [ escape ( ( '%s(%s)' % ( k , x ) ) , v_ ) for ( x , v_ ) in enumerate ( v ) ] ) else : out . append ( escape ( k , v ) ) return '&' . join ( out )
dumps a dict out into nvp pairs suitable for paypal to consume .