code: def unique_ports_constraint(ports: List[int]):
      used_ports = set()
      for i in ports:
          if i in used_ports:
              raise ConfigurationError(f"Port {i} is already in use")
          used_ports.add(i)
  
imports: import argparse
  import re
  import subprocess
  from typing import Dict, List, Optional, Tuple, Type
  from dstack._internal.cli.utils.common import console
  from dstack._internal.core.errors import ConfigurationError
  from dstack._internal.core.models.configurations import BaseConfiguration, BaseConfigurationWithPorts, ConfigurationType, DevEnvironmentConfiguration, PortMapping, ServiceConfiguration, TaskConfiguration
  from dstack._internal.utils.interpolator import VariablesInterpolator
label_desc: Use image node_id 4 for calling a global function with example usage: unique_ports_constraint(ports) without return types