def write_json(data, path, file_name):
if os.path.exists(path) and not os.path.isdir(path):<EOL><INDENT>return<EOL><DEDENT>elif not os.path.exists(path):<EOL><INDENT>mkdir_p(path)<EOL><DEDENT>with open(os.path.join(path, file_name), '<STR_LIT:w>') as f:<EOL><INDENT>json_tricks.dump(data, f, indent=<NUM_LIT:4>, primitives=True, allow_nan=True)<EOL><DEDENT>
Write out data to a json file.

Args:
    data: A dictionary representation of the data to write out
    path: The directory to output the file in
    file_name: The name of the file to write out