code: def set_project_entity_defaults(
      uri: Optional[str],
      job: Optional[str],
      api: Api,
      project: Optional[str],
      entity: Optional[str],
      launch_config: Optional[Dict[str, Any]],
  ) -> Tuple[Optional[str], str]:
      # set the target project and entity if not provided
      source_uri = None
      if uri is not None:
          if _is_wandb_uri(uri):
              _, source_uri, _ = parse_wandb_uri(uri)
          elif _is_git_uri(uri):
              source_uri = os.path.splitext(os.path.basename(uri))[0]
      elif job is not None:
          source_uri = get_project_from_job(job)
      if project is None:
          config_project = None
          if launch_config:
              config_project = launch_config.get("project")
          project = config_project or source_uri or ""
      if entity is None:
          entity = get_default_entity(api, launch_config)
      prefix = ""
      if (
          platform.system() != "Windows"
          and sys.stdout.encoding == "UTF-8"
      ):
          prefix = "🚀 "
      wandb.termlog(
          f"{LOG_PREFIX}{prefix}Launching run into {entity}{'/' + project if project else ''}"
      )
      return project, entity
  
imports: import asyncio
  import json
  import logging
  import os
  import platform
  import re
  import subprocess
  import sys
  from collections import defaultdict
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, cast
  import click
  import wandb
  import wandb.docker
  from wandb import util
  from wandb.apis.internal import Api
  from wandb.errors import CommError
  from wandb.sdk.launch.errors import LaunchError
  from wandb.sdk.launch.git_reference import GitReference
  from wandb.sdk.launch.wandb_reference import WandbReference
  from wandb.sdk.wandb_config import Config
  from .builder.templates._wandb_bootstrap import FAILED_PACKAGES_POSTFIX, FAILED_PACKAGES_PREFIX
label_desc: Use image node_id 9 for calling a global function with example usage: set_project_entity_defaults(uri, job, api, project, entity, launch_config) and returns: project,  entity