code: def save_csv(
      json_list, out_path, encoding="utf-8", headers=None, sep=","
  ):
      r"""
      Save json list to csv file.
  
      :param json_list: list of dict
      :param out_path: file path
      :param encoding: file's encoding, default: utf-8
      :param headers: file's headers, if None, make file's first line as headers.
          default: None
      :param sep: separator for each column. default: ','
      :return:
      """
      if not json_list or not isinstance(json_list, list):
          raise ValueError(
              f"Cant save invalid data {json_list}, provide list of dict plz!"
          )
      # mkdir dir automatically
      dir_path, file_path = os.path.split(out_path)
      if dir_path and not os.path.exists(dir_path):
          os.makedirs(dir_path)
  
      headers = headers if headers else json_list[0].keys()
  
      with open(out_path, "w+", encoding=encoding) as csv_file:
          writer = csv.DictWriter(
              csv_file, fieldnames=headers, delimiter=sep
          )
          writer.writeheader()
          writer.writerows(json_list)
  
imports: import os
  import json
  import csv
label_desc: Use image node_id 3 for calling a global function with example usage: save_csv(json_list, out_path, encoding, headers, sep) without return types