code: def _configure_key_pair(config):
      ssh_user = config["auth"]["ssh_user"]
      public_key = None
      # search if the keys exist
      for key_type in ["ssh_private_key", "ssh_public_key"]:
          try:
              key_path = Path(config["auth"][key_type]).expanduser()
          except KeyError:
              raise Exception("Config must define {}".format(key_type))
          except TypeError:
              raise Exception(
                  "Invalid config value for {}".format(key_type)
              )
  
          assert (
              key_path.is_file()
          ), "Could not find ssh key: {}".format(key_path)
  
          if key_type == "ssh_public_key":
              with open(key_path, "r") as f:
                  public_key = f.read()
  
      for node_type in config["available_node_types"].values():
          azure_arm_parameters = node_type["node_config"].setdefault(
              "azure_arm_parameters", {}
          )
          azure_arm_parameters["adminUsername"] = ssh_user
          azure_arm_parameters["publicKey"] = public_key
  
      return config
  
file_path: ray/python/ray/autoscaler/_private/_azure/config.py
imports: import json
  import logging
  import random
  from hashlib import sha256
  from pathlib import Path
  from typing import Any, Callable
  from azure.common.credentials import get_cli_profile
  from azure.identity import AzureCliCredential
  from azure.mgmt.resource import ResourceManagementClient
  from azure.mgmt.resource.resources.models import DeploymentMode
label_desc: Use image node_id 4 for calling a global function with example usage: _configure_key_pair(config) and returns: config