code: def create_instance_struct(
      disk_size: int,
      image_id: str,
      machine_type: str,
      accelerators: List[compute_v1.AcceleratorConfig],
      spot: bool,
      user_data: str,
      labels: Dict[str, str],
      tags: List[str],
      instance_name: str,
      zone: str,
      service_account: Optional[str] = None,
      network: str = "global/networks/default",
  ) -> compute_v1.Instance:
      network_interface = compute_v1.NetworkInterface()
      network_interface.name = network
  
      access = compute_v1.AccessConfig()
      access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name
      access.name = "External NAT"
      access.network_tier = access.NetworkTier.PREMIUM.name
      network_interface.access_configs = [access]
  
      instance = compute_v1.Instance()
      instance.network_interfaces = [network_interface]
      instance.name = instance_name
      instance.machine_type = (
          f"zones/{zone}/machineTypes/{machine_type}"
      )
  
      disk = compute_v1.AttachedDisk()
      disk.auto_delete = True
      disk.boot = True
      initialize_params = compute_v1.AttachedDiskInitializeParams()
      initialize_params.source_image = image_id
      initialize_params.disk_size_gb = disk_size
      initialize_params.disk_type = (
          f"zones/{zone}/diskTypes/pd-balanced"
      )
      disk.initialize_params = initialize_params
      instance.disks = [disk]
  
      if accelerators:
          instance.guest_accelerators = accelerators
  
      if (
          accelerators
          or machine_type.startswith("a2-")
          or machine_type.startswith("g2-")
      ):
          # Attachable GPUs, A100, and L4
          instance.scheduling.on_host_maintenance = "TERMINATE"
  
      if spot:
          instance.scheduling = compute_v1.Scheduling()
          instance.scheduling.provisioning_model = (
              compute_v1.Scheduling.ProvisioningModel.SPOT.name
          )
          instance.scheduling.instance_termination_action = (
              "STOP"  # TODO?
          )
  
      metadata_items = [
          compute_v1.Items(key="user-data", value=user_data),
      ]
      instance.metadata = compute_v1.Metadata(items=metadata_items)
  
      instance.labels = labels
      instance.tags = compute_v1.Tags(items=tags)
  
      if service_account is not None:
          instance.service_accounts = [
              compute_v1.ServiceAccount(
                  email=service_account,
                  scopes=[
                      "https://www.googleapis.com/auth/cloud-platform"
                  ],
              )
          ]
  
      return instance
  
file_path: dstack/src/dstack/_internal/core/backends/gcp/resources.py
imports: from typing import Dict, List, Optional
  import google.api_core.exceptions
  import google.cloud.compute_v1
  from google.api_core.extended_operation import ExtendedOperation
  import dstack.version
  from dstack._internal.core.models.instances import Gpu
  from dstack._internal.utils.logging import get_logger
label_desc: Use image node_id 1 for calling a global function with example usage: create_instance_struct(disk_size, image_id, machine_type, accelerators, spot, user_data, labels, tags, instance_name, zone, service_account, network) and returns: instance