code: def update_datafusion_version(cargo_toml: str, new_version: str):
      print(f"updating {cargo_toml}")
      with open(cargo_toml) as f:
          data = f.read()
  
      doc = tomlkit.parse(data)
      pkg = doc.get("package")
      if "workspace" not in pkg["version"]:
          pkg["version"] = new_version
  
      with open(cargo_toml, "w") as f:
          f.write(tomlkit.dumps(doc))
  
file_path: arrow-datafusion/dev/update_datafusion_versions.py
imports: import re
  import argparse
  from pathlib import Path
  import tomlkit
label_desc: Use image node_id 2 for calling a global function with example usage: update_datafusion_version(cargo_toml, new_version) without return types