def decode_from_querystring(s, **kw):
 if (not isinstance(s, unicode)):
  raise TypeError(u'unicode required')
 try:
  return urlsafe_b64decode(s.encode(u'ascii').replace('~', '=')).decode(u'utf8')
 except:
  if (u'default' in kw):
   return kw[u'default']
  raise Response(400, u'invalid input')

def decode_from_querystring ( s , ** kw ) : if ( not isinstance ( s , unicode ) ) : raise TypeError ( u'unicode required' ) try : return urlsafe_b64decode ( s . encode ( u'ascii' ) . replace ( '~' , '=' ) ) . decode ( u'utf8' ) except : if ( u'default' in kw ) : return kw [ u'default' ] raise Response ( 400 , u'invalid input' )
given a unicode computed by encode_for_querystring .