code: def url_from_repo(template_location: Optional[str]) -> Optional[str]:
      if template_location is None:
          return None
  
      if ":" in template_location and "/" in template_location:
          parts = template_location.split(":")
          branch_or_hash = parts[1]
          repo = parts[0]
      elif ":" not in template_location and "/" in template_location:
          branch_or_hash = STABLE_BRANCH
          repo = template_location
      else:
          branch_or_hash = template_location
          repo = DEFAULT_REPO
  
      manifest_url = (
          f"https://raw.githubusercontent.com/{repo}/{branch_or_hash}"
          "/packages/hagrid/hagrid/manifest_template.yml"
      )
  
      if is_url(manifest_url):
          return manifest_url
      return None
  
imports: import hashlib
  import os
  import shutil
  from typing import Dict
  from typing import List
  from typing import Optional
  from typing import Tuple
  from typing import Union
  from urllib.parse import urlparse
  from jinja2 import Environment
  from jinja2 import FileSystemLoader
  from jinja2 import Template
  import requests
  from rich.progress import track
  import yaml
  from .cache import DEFAULT_REPO
  from .cache import STABLE_BRANCH
  from .lib import hagrid_cache_dir
  from .lib import manifest_template_path
  from .lib import repo_src_path
  from .mode import EDITABLE_MODE
label_desc: Use image node_id 8 for calling a global function with example usage: url_from_repo(template_location) and returns: None, None, manifest_url