code: def _get_or_create_vpc_security_groups(conf, node_types):
      # Figure out which VPC each node_type is in...
      ec2 = _resource("ec2", conf)
      node_type_to_vpc = {
          node_type: _get_vpc_id_or_die(
              ec2,
              conf["available_node_types"][node_type]["node_config"][
                  "SubnetIds"
              ][0],
          )
          for node_type in node_types
      }
  
      # Generate the name of the security group we're looking for...
      expected_sg_name = (
          conf["provider"]
          .get("security_group", {})
          .get(
              "GroupName",
              SECURITY_GROUP_TEMPLATE.format(conf["cluster_name"]),
          )
      )
  
      # Figure out which security groups with this name exist for each VPC...
      vpc_to_existing_sg = {
          sg.vpc_id: sg
          for sg in _get_security_groups(
              conf,
              node_type_to_vpc.values(),
              [expected_sg_name],
          )
      }
  
      # Lazily create any security group we're missing for each VPC...
      vpc_to_sg = LazyDefaultDict(
          partial(
              _create_security_group, conf, group_name=expected_sg_name
          ),
          vpc_to_existing_sg,
      )
  
      # Then return a mapping from each node_type to its security group...
      return {
          node_type: vpc_to_sg[vpc_id]
          for node_type, vpc_id in node_type_to_vpc.items()
      }
  
imports: import copy
  import itertools
  import json
  import logging
  import os
  import time
  from collections import Counter
  from functools import lru_cache, partial
  from typing import Any, Dict, List, Optional, Set, Tuple
  import boto3
  import botocore
  from packaging.version import Version
  from ray.autoscaler._private.aws.cloudwatch.cloudwatch_helper import CloudwatchHelper
  from ray.autoscaler._private.aws.utils import LazyDefaultDict, handle_boto_error, resource_cache
  from ray.autoscaler._private.cli_logger import cf, cli_logger
  from ray.autoscaler._private.event_system import CreateClusterEvent, global_event_system
  from ray.autoscaler._private.providers import _PROVIDER_PRETTY_NAMES
  from ray.autoscaler._private.util import check_legacy_fields
  from ray.autoscaler.tags import NODE_TYPE_LEGACY_HEAD, NODE_TYPE_LEGACY_WORKER
label_desc: Use image node_id 17 for calling a global function with example usage: _get_or_create_vpc_security_groups(conf, node_types) and returns: unknown