def B64HexDecode(s, padding=True):
 s = utf8(s)
 if (not _valid_char_re.match(s)):
  raise TypeError('Invalid characters')
 pad_needed = (len(s) % _PAD_LEN)
 if pad_needed:
  if padding:
   raise TypeError('Invalid padding')
  else:
   s += ('=' * pad_needed)
 translated = s.translate(_b64hex_to_std)
 return base64.b64decode(translated)

def B64HexDecode ( s , padding = True ) : s = utf8 ( s ) if ( not _valid_char_re . match ( s ) ) : raise TypeError ( 'Invalid characters' ) pad_needed = ( len ( s ) % _PAD_LEN ) if pad_needed : if padding : raise TypeError ( 'Invalid padding' ) else : s += ( '=' * pad_needed ) translated = s . translate ( _b64hex_to_std ) return base64 . b64decode ( translated )
decode a base64 encoded string .