code: def update_bumpenvs_yaml(table: List[List[str]], path: str) -> None:
      with open(path) as f:
          bumpenvs_conf = yaml.YAML(typ="safe", pure=True).load(f)
  
      # All master-amis and bastion-amis in bumpenvs.yaml are updated.
      # The agent-amis are updated after each rebuild of the environments repo.
      for image_type, subconf in bumpenvs_conf.items():
          if image_type.endswith("_master_ami"):
              region = image_type[: -len("_master_ami")].replace(
                  "_", "-"
              )
              # Master AMIs are based on Focal.
              new_ami = get_ubuntu_ami(table, "focal", region)
              if new_ami is not None:
                  update_tag_for_image_type(subconf, new_ami)
  
          if image_type.endswith("_bastion_ami"):
              region = image_type[: -len("_bastion_ami")].replace(
                  "_", "-"
              )
              # Bastion AMIs are based on Focal.
              new_ami = get_ubuntu_ami(table, "focal", region)
              if new_ami is not None:
                  update_tag_for_image_type(subconf, new_ami)
  
      with open(path, "w") as f:
          yaml.YAML(typ="safe", pure=True).dump(bumpenvs_conf, f)
  
file_path: determined/tools/scripts/refresh-ubuntu-amis.py
imports: import argparse
  import json
  import re
  import sys
  from typing import Dict, List, Union
  import requests
  from ruamel import yaml
label_desc: Use image node_id 3 for calling a global function with example usage: update_bumpenvs_yaml(table, path) without return types