code: def _create_compute(
      compute: str | None,
      cluster_name: str,
      aws_conn_id: str,
      region: str | None,
      waiter_delay: int,
      waiter_max_attempts: int,
      wait_for_completion: bool = False,
      nodegroup_name: str | None = None,
      nodegroup_role_arn: str | None = None,
      create_nodegroup_kwargs: dict | None = None,
      fargate_profile_name: str | None = None,
      fargate_pod_execution_role_arn: str | None = None,
      fargate_selectors: list | None = None,
      create_fargate_profile_kwargs: dict | None = None,
      subnets: list[str] | None = None,
  ):
      log = logging.getLogger(__name__)
      eks_hook = EksHook(aws_conn_id=aws_conn_id, region_name=region)
      if compute == "nodegroup" and nodegroup_name:
          # this is to satisfy mypy
          subnets = subnets or []
          create_nodegroup_kwargs = create_nodegroup_kwargs or {}
  
          eks_hook.create_nodegroup(
              clusterName=cluster_name,
              nodegroupName=nodegroup_name,
              subnets=subnets,
              nodeRole=nodegroup_role_arn,
              **create_nodegroup_kwargs,
          )
          if wait_for_completion:
              log.info(
                  "Waiting for nodegroup to provision.  This will take some time."
              )
              wait(
                  waiter=eks_hook.conn.get_waiter("nodegroup_active"),
                  waiter_delay=waiter_delay,
                  waiter_max_attempts=waiter_max_attempts,
                  args={
                      "clusterName": cluster_name,
                      "nodegroupName": nodegroup_name,
                  },
                  failure_message="Nodegroup creation failed",
                  status_message="Nodegroup status is",
                  status_args=["nodegroup.status"],
              )
      elif compute == "fargate" and fargate_profile_name:
          # this is to satisfy mypy
          create_fargate_profile_kwargs = (
              create_fargate_profile_kwargs or {}
          )
          fargate_selectors = fargate_selectors or []
  
          eks_hook.create_fargate_profile(
              clusterName=cluster_name,
              fargateProfileName=fargate_profile_name,
              podExecutionRoleArn=fargate_pod_execution_role_arn,
              selectors=fargate_selectors,
              **create_fargate_profile_kwargs,
          )
          if wait_for_completion:
              log.info(
                  "Waiting for Fargate profile to provision.  This will take some time."
              )
              wait(
                  waiter=eks_hook.conn.get_waiter(
                      "fargate_profile_active"
                  ),
                  waiter_delay=waiter_delay,
                  waiter_max_attempts=waiter_max_attempts,
                  args={
                      "clusterName": cluster_name,
                      "fargateProfileName": fargate_profile_name,
                  },
                  failure_message="Fargate profile creation failed",
                  status_message="Fargate profile status is",
                  status_args=["fargateProfile.status"],
              )
  
imports: from __future__ import annotations
  import logging
  import warnings
  from ast import literal_eval
  from datetime import timedelta
  from functools import cached_property
  from typing import TYPE_CHECKING, Any, List, Sequence, cast
  from botocore.exceptions import ClientError, WaiterError
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
  from airflow.models import BaseOperator
  from airflow.providers.amazon.aws.hooks.eks import EksHook
  from airflow.providers.amazon.aws.triggers.eks import EksCreateClusterTrigger, EksCreateFargateProfileTrigger, EksCreateNodegroupTrigger, EksDeleteClusterTrigger, EksDeleteFargateProfileTrigger, EksDeleteNodegroupTrigger
  from airflow.providers.amazon.aws.utils.waiter_with_logging import wait
  from airflow.providers.cncf.kubernetes.utils.pod_manager import OnFinishAction
label_desc: Use image node_id 1 for calling a global function with example usage: _create_compute(compute, cluster_name, aws_conn_id, region, waiter_delay, waiter_max_attempts, wait_for_completion, nodegroup_name, nodegroup_role_arn, create_nodegroup_kwargs, fargate_profile_name, fargate_pod_execution_role_arn, fargate_selectors, create_fargate_profile_kwargs, subnets) without return types