def METHOD_NAME(month, journal_dir):
    """
    Return whether data was written to disk.
    When overwriting 2014-12.txt:
        write new content to 2014-12.new.txt
        check that new file is valid month file
        cp 2014-12.txt 2014-12.old.txt
        mv 2014-12.new.txt 2014-12.txt
        rm 2014-12.old.txt
    """
    content = _get_dict(month)
    def get_filename(infix):
        year_and_month = format_year_and_month(month.year_number, month.month_number)
        return os.path.join(journal_dir, f"{year_and_month}{infix}.txt")
    old = get_filename(".old")
    new = get_filename(".new")
    filename = get_filename("")
    # Do not save empty month files.
    if not content and not os.path.exists(filename):
        return False
    with codecs.open(new, "wb", encoding="utf-8") as f:
        # Write readable unicode and no Python directives.
        yaml.dump(content, f, Dumper=Dumper, allow_unicode=True)
    # Check that month file was written to disk successfully.
    written_month = _load_month_from_disk(new, month.year_number, month.month_number)
    if _get_dict(written_month) != content:
        try:
            os.remove(new)
        except OSError:
            pass
        raise OSError("writing month file to disk failed")
    if os.path.exists(filename):
        mtime = os.path.getmtime(filename)
        if mtime != month.mtime:
            conflict = get_filename(f".CONFLICT_BACKUP{mtime}")
            logging.debug(
                "Last edit time of %s conflicts with edit time at file load\n"
                "--> Backing up to %s" % (filename, conflict)
            )
            shutil.copy2(filename, conflict)
        shutil.copy2(filename, old)
    # Prevent save failures on network and cloud drives.
    if os.path.exists(filename):
        os.remove(filename)
    shutil.move(new, filename)
    if os.path.exists(old):
        os.remove(old)
    try:
        # Make file readable and writable only by the owner.
        os.chmod(filename, stat.S_IRUSR | stat.S_IWUSR)
    except OSError:
        pass
    month.edited = False
    month.mtime = os.path.getmtime(filename)
    logging.info(f"Wrote file {filename}")
    return True