def base64_decodefile(instr, outfile):
 encoded_f = StringIO.StringIO(instr)
 with open(outfile, 'wb') as f:
  base64.decode(encoded_f, f)
 return True

def base64_decodefile ( instr , outfile ) : encoded_f = StringIO . StringIO ( instr ) with open ( outfile , 'wb' ) as f : base64 . decode ( encoded_f , f ) return True
decode a base64-encoded string and write the result to a file .