def transcode(input_filename, output_filename=None, date_format=None):
if output_filename is None:<EOL><INDENT>output = sys.stdout<EOL><DEDENT>else:<EOL><INDENT>if output_filename.endswith('<STR_LIT>'):<EOL><INDENT>logger.warning("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>output_filename += '<STR_LIT:s>'<EOL><DEDENT>output = open(output_filename, '<STR_LIT:w>')<EOL><DEDENT>for entry in open_json_or_csv_somehow(input_filename,<EOL>date_format=date_format):<EOL><INDENT>output.write(json.dumps(entry, ensure_ascii=False).encode('<STR_LIT:utf-8>'))<EOL>output.write('<STR_LIT:\n>')<EOL><DEDENT>output.close()<EOL>
Convert a JSON or CSV file of input to a JSON stream (.jsons). This
kind of file can be easily uploaded using `luminoso_api.upload`.