code: def _create_repo_metadata(
      path: str,
      tempdir: str,
      entrypoint: Optional[str] = None,
      git_hash: Optional[str] = None,
      runtime: Optional[str] = None,
  ) -> Optional[Dict[str, Any]]:
      if not _is_git_uri(path):
          wandb.termerror("Path must be a git URI")
          return None
  
      ref = GitReference(path, git_hash)
      if not ref:
          wandb.termerror("Could not parse git URI")
          return None
  
      ref.fetch(tempdir)
  
      commit = ref.commit_hash
      if not commit:
          if not ref.commit_hash:
              wandb.termerror("Could not find git commit hash")
              return None
          commit = ref.commit_hash
  
      local_dir = os.path.join(tempdir, ref.path or "")
      python_version = runtime
      if not python_version:
          if os.path.exists(os.path.join(local_dir, "runtime.txt")):
              with open(os.path.join(local_dir, "runtime.txt")) as f:
                  python_version = f.read().strip()
          elif os.path.exists(
              os.path.join(local_dir, ".python-version")
          ):
              with open(
                  os.path.join(local_dir, ".python-version")
              ) as f:
                  python_version = f.read().strip().splitlines()[0]
          else:
              major, minor = get_current_python_version()
              python_version = f"{major}.{minor}"
  
      python_version = _clean_python_version(python_version)
  
      # check if entrypoint is valid
      assert entrypoint is not None
      if not os.path.exists(os.path.join(local_dir, entrypoint)):
          wandb.termerror(
              f"Entrypoint {entrypoint} not found in git repo"
          )
          return None
  
      # check if requirements.txt exists
      # start at the location of the python file and recurse up to the git root
      req_dir = local_dir
      while (
          not os.path.exists(os.path.join(req_dir, "requirements.txt"))
          and req_dir != tempdir
      ):
          req_dir = os.path.dirname(req_dir)
  
      if not os.path.exists(os.path.join(req_dir, "requirements.txt")):
          wandb.termerror(
              f"Could not find requirements.txt file in git repo at {path}"
          )
          return None
  
      wandb.termlog(
          f"Using requirements.txt in {req_dir.replace(tempdir, '') or 'repository root'}"
      )
  
      metadata = {
          "git": {
              "commit": commit,
              "remote": ref.url,
          },
          "codePathLocal": entrypoint,  # not in git context, optionally also set local
          "codePath": entrypoint,
          "entrypoint": [f"python{python_version}", entrypoint],
          "python": python_version,  # used to build container
          "notebook": False,  # partial jobs from notebooks not supported
      }
  
      return metadata
  
imports: import json
  import logging
  import os
  import sys
  import tempfile
  from typing import Any, Dict, List, Optional, Tuple
  import wandb
  from wandb.apis.internal import Api
  from wandb.sdk.artifacts.artifact import Artifact
  from wandb.sdk.internal.job_builder import JobBuilder
  from wandb.sdk.launch.builder.build import get_current_python_version
  from wandb.sdk.launch.git_reference import GitReference
  from wandb.sdk.launch.utils import _is_git_uri
  from wandb.sdk.lib import filesystem
  from wandb.util import make_artifact_name_safe
label_desc: Use image node_id 4 for calling a global function with example usage: _create_repo_metadata(path, tempdir, entrypoint, git_hash, runtime) and returns: metadata, None, None, None, None, None