#1466065: add validate option to base64.b64decode

Patch by Neil Tallim.  This provides a mechanism for module
users to achieve RFC 3548 compliance in the cases where ignoring
non-base64-alphabet input characters is *not* mandated by the RFC that
references RFC 3548.
diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst
index c10a74a..2401ae7 100644
--- a/Doc/library/base64.rst
+++ b/Doc/library/base64.rst
@@ -37,7 +37,7 @@
    The encoded byte string is returned.
 
 
-.. function:: b64decode(s, altchars=None)
+.. function:: b64decode(s, altchars=None, validate=False)
 
    Decode a Base64 encoded byte string.
 
@@ -45,9 +45,13 @@
    at least length 2 (additional characters are ignored) which specifies the
    alternative alphabet used instead of the ``+`` and ``/`` characters.
 
-   The decoded byte string is returned.  A :exc:`TypeError` is raised if *s* were
-   incorrectly padded or if there are non-alphabet characters present in the
-   string.
+   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
+   :exc:`binascii.Error`.
 
 
 .. function:: standard_b64encode(s)