def urlsafe_base64_decode(s):
 s = s.encode(u'utf-8')
 try:
  return base64.urlsafe_b64decode(s.ljust((len(s) + (len(s) % 4)), '='))
 except (LookupError, BinasciiError) as e:
  raise ValueError(e)

def urlsafe_base64_decode ( s ) : s = s . encode ( u'utf-8' ) try : return base64 . urlsafe_b64decode ( s . ljust ( ( len ( s ) + ( len ( s ) % 4 ) ) , '=' ) ) except ( LookupError , BinasciiError ) as e : raise ValueError ( e )
decodes a base64 encoded string .