code: def deploy_single(
      self, instance_name: str, instance: InstanceType, cloudinit: dict
  ) -> dict:
      hostnode = self.get_hostnode(instance.name)
      gpu = instance.resources.gpus[0]
      for gpu_model in hostnode["specs"]["gpu"].keys():
          if gpu_model.endswith(f"-{gpu.memory_mib // 1024}gb"):
              if gpu.name.lower() in gpu_model.lower():
                  break
      else:
          raise ValueError(
              f"Can't find GPU on the hostnode: {gpu.name}"
          )
      form = {
          "api_key": self.api_key,
          "api_token": self.api_token,
          "password": uuid.uuid4().hex,  # we disable the password auth, but it's required
          "name": instance_name,
          "gpu_count": len(instance.resources.gpus),
          "gpu_model": gpu_model,
          "vcpus": instance.resources.cpus,
          "ram": instance.resources.memory_mib // 1024,
          "external_ports": "{%s}"
          % max(
              hostnode["networking"]["ports"]
          ),  # it's safer to use a higher port
          "internal_ports": "{22}",
          "hostnode": instance.name,
          "storage": 100,  # TODO(egor-s): take from instance.resources
          "operating_system": "Ubuntu 22.04 LTS",
          "cloudinit_script": yaml.dump(cloudinit).replace("\n", "\\n"),
      }
      logger.debug(
          "Deploying instance hostnode=%s, cpus=%s, memory=%s, gpu=%sx %s",
          form["hostnode"],
          form["vcpus"],
          form["ram"],
          form["gpu_count"],
          form["gpu_model"],
      )
      resp = self.s.post(self._url("/client/deploy/single"), data=form)
      resp.raise_for_status()
      data = resp.json()
      if not data["success"]:
          raise requests.HTTPError(data)
      data["password"] = form["password"]
      return data
  
file_path: dstack/src/dstack/_internal/core/backends/tensordock/api_client.py
imports: import uuid
  import requests
  import yaml
  from dstack._internal.core.models.instances import InstanceType
  from dstack._internal.utils.logging import get_logger
label_desc: Use image node_id 4 for calling the TensorDockAPIClient obj's underlying member method code with example usage: obj.deploy_single(instance_name, instance, cloudinit) and returns: data