code: def encode(input, output):
      
      while True:
          s = input.read(MAXBINSIZE)
          if not s:
              break
          while len(s) < MAXBINSIZE:
              ns = input.read(MAXBINSIZE-len(s))
              if not ns:
                  break
              s += ns
          line = binascii.b2a_base64(s)
          output.write(line)
docs: Encode a file.