code: def write_version_to_pyproject(version: Version) -> None:
      """Dump a new version into the pyproject.toml."""
      pyproject_file = pyproject_file_path()
  
      try:
          data = toml.load(pyproject_file)
          data["tool"]["poetry"]["version"] = str(version)
          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)
  
      check_call(["git", "add", str(pyproject_file.absolute())])
  
imports: import argparse
  import os
  import re
  import sys
  from pathlib import Path
  from subprocess import CalledProcessError, check_call, check_output
  from typing import Text, Set
  import questionary
  import toml
  from pep440_version_utils import Version, is_valid_version
label_desc: Use image node_id 6 for calling a global function with example usage: write_version_to_pyproject(version) without return types