code: def write_version_to_pyproject(
      pyproject_file_path: Text, version: Version
  ) -> None:
      """Dump a new version into the pyproject.toml."""
  
      pyproject_file = project_root() / pyproject_file_path
  
      try:
          data = toml.load(pyproject_file)
          data["tool"]["poetry"]["name"] = "rasa-nightly"
          data["tool"]["poetry"]["version"] = str(version)
          data["tool"]["poetry"]["packages"] = [
              {"include": "rasa"},
          ]
          with pyproject_file.open("w", encoding="utf8") as f:
              toml.dump(data, f)
      except (FileNotFoundError, TypeError):
          print(f"Unable to update {pyproject_file}: file not found.")
          sys.exit(1)
      except toml.TomlDecodeError:
          print(
              f"Unable to parse {pyproject_file}: incorrect TOML file."
          )
          sys.exit(1)
  
file_path: rasa/scripts/prepare_nightly_release.py
imports: import argparse
  import os
  import sys
  import toml
  from pathlib import Path
  from typing import Text
  from pep440_version_utils import Version, is_valid_version
label_desc: Use image node_id 4 for calling a global function with example usage: write_version_to_pyproject(pyproject_file_path, version) without return types