code: def save_file(data, export_file):
      
      create_dir(os.path.dirname(export_file))
  
      try:
          with open(export_file, "w") as file:
              file.write(data)
      except PermissionError:
          logging.warning("Couldn't write to %s.", export_file)
docs: Write data to a file.