code: def stack_exists(
      stack_name: str, boto3_session: boto3.session.Session
  ) -> bool:
      cfn = boto3_session.client("cloudformation")
  
      print(
          f"Checking if the CloudFormation Stack ({stack_name}) exists:",
          end=" ",
      )
  
      try:
          cfn.describe_stacks(StackName=stack_name)
      except ClientError:
          return False
  
      return True
  
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 6 for calling a global function with example usage: stack_exists(stack_name, boto3_session) and returns: True, False