code: def _overwrite(self, filename, func, force=False):
      
      now = int(time.time() * 1000)
      last_overwrite_time = self._last_overwrite_time.get(filename) or now
      # Overwrite only once per second.
      if (now - last_overwrite_time >= 1000) or force:
        if os.path.exists(self._html_dir):  # Make sure we're not immediately after a clean-all.
          with open(os.path.join(self._html_dir, filename), 'w') as f:
            f.write(func())
        self._last_overwrite_time[filename] = now
docs: Overwrite a file with the specified contents.
  
      Write times are tracked, too-frequent overwrites are skipped, for performance reasons.
  
      :param filename: The path under the html dir to write to.
      :param func: A no-arg function that returns the contents to write.
      :param force: Whether to force a write now, regardless of the last overwrite time.