code: def check_keypair(
      name: str, boto3_session: boto3.session.Session
  ) -> bool:
      ec2 = boto3_session.client("ec2")
  
      print(f"Checking if the SSH Keypair ({name}) exists:", end=" ")
      all_keys = ec2.describe_key_pairs()["KeyPairs"]
      names = [x["KeyName"] for x in all_keys]
  
      if name in names:
          print("True")
          return True
  
      print("False")
      print(
          f"Key pair {name} not found in {boto3_session.region_name}. "
          f"Please create the key pair {name} in {boto3_session.region_name} first"
      )
      sys.exit(1)
  
imports: import sys
  import threading
  import time
  from typing import Any, Callable, Dict, List, Optional, Tuple
  import boto3
  import tqdm
  from botocore.exceptions import ClientError, WaiterError
  from determined.deploy.aws import constants
label_desc: Use image node_id 17 for calling a global function with example usage: check_keypair(name, boto3_session) and returns: True