code: def save_file(filename, data, mk_parents=True):
      
      parent = filename.parent
      if not parent.exists() and mk_parents:
          logger.debug("Creating directory: %s", parent.as_posix())
          parent.mkdir(parents=True)
      with open(filename, mode="w") as f:
          logger.debug("Saving file: %s", filename.as_posix())
          f.write(data)
docs: Save file to disk.
  
      Paramaters
      ----------
      filename : pathlib.Path
          Path to the file.
      data : str
          File contents.
      mk_parents : bool, optional
          If to create parent directories.