parameters: (s, binary=True, maxlinelen=76, eol=NL)
return_statement: return EMPTYSTRING.join(encvec)
docstring: Encode a string with base64.
  
      Each line will be wrapped at, at most, maxlinelen characters (defaults to
      76 characters).
  
      If binary is False, end-of-line characters will be converted to the
      canonical email end-of-line sequence \\r\\n.  Otherwise they will be left
      verbatim (this is the default).
  
      Each line of encoded text will end with eol, which defaults to "\\n".  Set
      this to "\r\n" if you will be using the result of this function directly
      in an email.
docstring_summary: Encode a string with base64.
docstring_tokens: Encode a string with base64 .
function: def encode(s, binary=True, maxlinelen=76, eol=NL):
      """Encode a string with base64.
  
      Each line will be wrapped at, at most, maxlinelen characters (defaults to
      76 characters).
  
      If binary is False, end-of-line characters will be converted to the
      canonical email end-of-line sequence \\r\\n.  Otherwise they will be left
      verbatim (this is the default).
  
      Each line of encoded text will end with eol, which defaults to "\\n".  Set
      this to "\r\n" if you will be using the result of this function directly
      in an email.
      """
      if not s:
          return s
  
      if not binary:
          s = fix_eols(s)
  
      encvec = []
      max_unencoded = maxlinelen * 3 // 4
      for i in range(0, len(s), max_unencoded):
          # BAW: should encode() inherit b2a_base64()'s dubious behavior in
          # adding a newline to the encoded string?
          enc = b2a_base64(s[i:i + max_unencoded])
          if enc.endswith(NL) and eol != NL:
              enc = enc[:-1] + eol
          encvec.append(enc)
      return EMPTYSTRING.join(encvec)
function_tokens: def encode ( s , binary = True , maxlinelen = 76 , eol = NL ) : if not s : return s if not binary : s = fix_eols ( s ) encvec = [ ] max_unencoded = maxlinelen * 3 // 4 for i in range ( 0 , len ( s ) , max_unencoded ) : # BAW: should encode() inherit b2a_base64()'s dubious behavior in # adding a newline to the encoded string? enc = b2a_base64 ( s [ i : i + max_unencoded ] ) if enc . endswith ( NL ) and eol != NL : enc = enc [ : - 1 ] + eol encvec . append ( enc ) return EMPTYSTRING . join ( encvec )