code: def b64decode(s, altchars=None, validate=False):
      
      if version_info < (3, 0) or validate:
          if validate and len(s) % 4 != 0:
              raise BinAsciiError('Incorrect padding')
          s = _get_bytes(s)
          if altchars is not None:
              altchars = _get_bytes(altchars)
              assert len(altchars) == 2, repr(altchars)
              if version_info < (3, 0):
                  map = maketrans(altchars, b'+/')
              else:
                  map = bytes.maketrans(altchars, b'+/')
              s = s.translate(map)
          try:
              result = builtin_decode(s, altchars)
          except TypeError as e:
              raise BinAsciiError(str(e))
          if validate:
              # check length of result vs length of input
              padding = 0
              if len(s) > 1 and s[-2] in (b'=', 61):
                  padding = padding + 1
              if len(s) > 0 and s[-1] in (b'=', 61):
                  padding = padding + 1
              if 3 * (len(s) / 4) - padding != len(result):
                  raise BinAsciiError('Non-base64 digit found')
          return result
      return builtin_decode(s, altchars)
docs: Decode bytes encoded with the standard Base64 alphabet.
  
      Argument ``s`` is a :term:`bytes-like object` or ASCII string to
      decode.
  
      Optional ``altchars`` must be a :term:`bytes-like object` or ASCII
      string of length 2 which specifies the alternative alphabet used instead
      of the '+' and '/' characters.
  
      If ``validate`` is ``False`` (the default), characters that are neither in
      the normal base-64 alphabet nor the alternative alphabet are discarded
      prior to the padding check.
      If ``validate`` is ``True``, these non-alphabet characters in the input
      result in a :exc:`binascii.Error`.
  
      The result is returned as a :class:`bytes` object.
  
      A :exc:`binascii.Error` is raised if ``s`` is incorrectly padded.