code: def update_downstream_versions(cargo_toml: str, new_version: str):
      with open(cargo_toml) as f:
          data = f.read()
  
      doc = tomlkit.parse(data)
  
      for crate in crates.keys():
          df_dep = doc.get("dependencies", {}).get(crate)
          # skip crates that pin datafusion using git hash
          if df_dep is not None and df_dep.get("version") is not None:
              print(f"updating {crate} dependency in {cargo_toml}")
              df_dep["version"] = new_version
  
          df_dep = doc.get("dev-dependencies", {}).get(crate)
          if df_dep is not None and df_dep.get("version") is not None:
              print(f"updating {crate} dev-dependency in {cargo_toml}")
              df_dep["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 3 for calling a global function with example usage: update_downstream_versions(cargo_toml, new_version) without return types