(s, altchars=None, validate=False)
return binascii.a2b_base64(s)
Decode a Base64 encoded byte string.

    s is the byte string to decode.  Optional altchars must be a
    string of length 2 which specifies the alternative alphabet used
    instead of the '+' and '/' characters.

    The decoded string is returned.  A binascii.Error is raised if s is
    incorrectly padded.

    If validate is False (the default), non-base64-alphabet characters are
    discarded prior to the padding check.  If validate is True,
    non-base64-alphabet characters in the input result in a binascii.Error.
Decode a Base64 encoded byte string.
Decode a Base64 encoded byte string .
def b64decode(s, altchars=None, validate=False):
    """Decode a Base64 encoded byte string.

    s is the byte string to decode.  Optional altchars must be a
    string of length 2 which specifies the alternative alphabet used
    instead of the '+' and '/' characters.

    The decoded string is returned.  A binascii.Error is raised if s is
    incorrectly padded.

    If validate is False (the default), non-base64-alphabet characters are
    discarded prior to the padding check.  If validate is True,
    non-base64-alphabet characters in the input result in a binascii.Error.
    """
    if not isinstance(s, bytes_types):
        raise TypeError("expected bytes, not %s" % s.__class__.__name__)
    if altchars is not None:
        if not isinstance(altchars, bytes_types):
            raise TypeError("expected bytes, not %s"
                            % altchars.__class__.__name__)
        assert len(altchars) == 2, repr(altchars)
        s = _translate(s, {chr(altchars[0]): b'+', chr(altchars[1]): b'/'})
    if validate and not re.match(b'^[A-Za-z0-9+/]*={0,2}$', s):
        raise binascii.Error('Non-base64 digit found')
    return binascii.a2b_base64(s)
def b64decode ( s , altchars = None , validate = False ) : if not isinstance ( s , bytes_types ) : raise TypeError ( "expected bytes, not %s" % s . __class__ . __name__ ) if altchars is not None : if not isinstance ( altchars , bytes_types ) : raise TypeError ( "expected bytes, not %s" % altchars . __class__ . __name__ ) assert len ( altchars ) == 2 , repr ( altchars ) s = _translate ( s , { chr ( altchars [ 0 ] ) : b'+' , chr ( altchars [ 1 ] ) : b'/' } ) if validate and not re . match ( b'^[A-Za-z0-9+/]*={0,2}$' , s ) : raise binascii . Error ( 'Non-base64 digit found' ) return binascii . a2b_base64 ( s )