code: def bytes_from_decode_data(s):
      
      if isinstance(s, (str, unicode)):
          try:
              return s.encode('ascii')
          except UnicodeEncodeError:
              raise NotValidParamError(
                  'String argument should contain only ASCII characters')
      if isinstance(s, bytes_types):
          return s
      try:
          return memoryview(s).tobytes()
      except TypeError:
          raise suppress_context(
              TypeError(
                  'Argument should be a bytes-like object or ASCII string, not '
                  '{!r}'.format(s.__class__.__name__)))
docs: copy from base64._bytes_from_decode_data