code: def list_stacks(
      boto3_session: boto3.session.Session,
  ) -> List[Dict[str, Any]]:
      cfn = boto3_session.client("cloudformation")
      paginator = cfn.get_paginator("describe_stacks")
  
      output = []
      for response in paginator.paginate():
          for stack in response["Stacks"]:
              for tag in stack["Tags"]:
                  if (
                      tag["Key"] == constants.defaults.STACK_TAG_KEY
                      and tag["Value"]
                      == constants.defaults.STACK_TAG_VALUE
                  ) or (
                      tag["Key"]
                      == constants.deployment_types.TYPE_TAG_KEY
                  ):
                      output.append(stack)
                      break
      return output
  
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 10 for calling a global function with example usage: list_stacks(boto3_session) and returns: output