class_docstr: Attributes:
      commands (List[str]): The bash commands to run
      port (PortMapping): The port, that application listens to or the mapping
      env (Dict[str, str]): The mapping or the list of environment variables
      image (Optional[str]): The name of the Docker image to run
      python (Optional[str]): The major version of Python
      entrypoint (Optional[str]): The Docker entrypoint
      registry_auth (Optional[RegistryAuth]): Credentials for pulling a private Docker image
      home_dir (str): The absolute path to the home directory inside the container. Defaults to `/root`.
code: def convert_port(cls, v) -> PortMapping:
      if isinstance(v, int):
          return PortMapping(local_port=80, container_port=v)
      elif isinstance(v, str):
          return PortMapping.parse(v)
      return v
  
imports: import re
  from enum import Enum
  from typing import Dict, List, Optional, Union
  from pydantic import BaseModel, Field, ValidationError, conint, constr, validator
  from typing_extensions import Annotated, Literal
  from dstack._internal.core.errors import ConfigurationError
  from dstack._internal.core.models.common import ForbidExtra
  from dstack._internal.core.models.repos.base import Repo
  from dstack._internal.core.models.repos.virtual import VirtualRepo
label_desc: Use image node_id 1 for calling the ServiceConfiguration obj's underlying member method code with example usage: obj.convert_port(cls, v) and returns: v, PortMapping, PortMapping