code: def write_update(rootfs_filepath: str,
                   progress_callback: Callable[[float], None],
                   chunk_size: int = 1024,
                   file_size: int = None) -> RootPartitions:
      
      unused = _find_unused_partition()
      part_path = unused.value.path
      write_file(rootfs_filepath, part_path, progress_callback,
                 chunk_size, file_size)
      return unused
docs: Write the new rootfs to the next root partition
  
      - Figure out, from the system, the correct root partition to write to
      - Write the rootfs at ``rootfs_filepath`` there, with progress
  
      :param rootfs_filepath: The path to a checked rootfs.ext4
      :param progress_callback: A callback to call periodically with progress
                                between 0 and 1.0. May never reach precisely
                                1.0, best only for user information.
      :param chunk_size: The size of file chunks to copy in between progress
                         notifications
      :param file_size: The total size of the update file (for generating
                        progress percentage). If ``None``, generated with
                        ``seek``/``tell``.
      :returns: The root partition that the rootfs image was written to, e.g.
                ``RootPartitions.TWO`` or ``RootPartitions.THREE``.