<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_file(path, data, format=True):
 """ Write JSON data to file. Arguments: path (str):
 Destination. data (dict or list):
 JSON serializable data. format (bool, optional):
 Pretty-print JSON data. """

    if format:
        fs.write_file(path, format_json(data))
    else:
        fs.write_file(path, json.dumps(data))