code: def _save_to_history(word, data_dir):
      
      if not data_dir.exists():
          logger.debug("Creating DATA DIR: %s", data_dir.as_posix())
          data_dir.mkdir(parents=True)
      if word not in _get_words(data_dir):
          with open(data_dir.joinpath("words.txt"), mode="a+") as f:
              logger.debug("Adding to history: %s", word)
              f.write(word + "\n")
docs: Write word to history file.
  
      Parameters
      ----------
      word : str
          Word to save to history.
      data_dir : pathlib.Path
          Directory where history file should be saved.
  
      data_dir and it's parent directories will be created if needed.