code: def _validate_placement_constraint(placement_constraint):
      # Currently only for CGO.
      if placement_constraint is None:
          raise ValueError("placement_constraint is None")
      if not "type" in placement_constraint:
          raise ValueError("placement_constraint must have `type`")
      if not "gpus" in placement_constraint:
          raise ValueError("placement_constraint must have `gpus`")
      if placement_constraint["type"] not in [
          "None",
          "GPUNumber",
          "Device",
      ]:
          raise ValueError(
              "placement_constraint.type must be either `None`,. `GPUNumber` or `Device`"
          )
      if (
          placement_constraint["type"] == "None"
          and len(placement_constraint["gpus"]) > 0
      ):
          raise ValueError(
              "placement_constraint.gpus must be an empty list when type == None"
          )
      if placement_constraint["type"] == "GPUNumber":
          if len(placement_constraint["gpus"]) != 1:
              raise ValueError(
                  "placement_constraint.gpus currently only support one host when type == GPUNumber"
              )
          for e in placement_constraint["gpus"]:
              if not isinstance(e, int):
                  raise ValueError(
                      "placement_constraint.gpus must be a list of number when type == GPUNumber"
                  )
      if placement_constraint["type"] == "Device":
          for e in placement_constraint["gpus"]:
              if not isinstance(e, tuple):
                  raise ValueError(
                      "placement_constraint.gpus must be a list of tuple when type == Device"
                  )
              if not (
                  len(e) == 2
                  and isinstance(e[0], str)
                  and isinstance(e[1], int)
              ):
                  raise ValueError(
                      "placement_constraint.gpus`s tuple must be (str, int)"
                  )
  
imports: from __future__ import annotations
  import logging
  import os
  from collections import defaultdict
  from threading import Event
  from typing import Any, Callable
  from nni.common.serializer import dump, load, PayloadTooLarge
  from nni.runtime.command_channel.websocket import WsChannelClient
  from nni.typehint import Parameters
  from .command_type import CommandType, TunerIncomingCommand, Initialize, RequestTrialJobs, UpdateSearchSpace, ReportMetricData, TrialEnd, Terminate
label_desc: Use image node_id 1 for calling a global function with example usage: _validate_placement_constraint(placement_constraint) without return types