<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _overwrite(self, filename, func, force=False):
 """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. """

    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