code: def clean_repo_path(repo_path: Union[str, pathlib.Path]) -> str:
      if isinstance(repo_path, pathlib.Path):
          repo_path = str(repo_path)
  
      if not isinstance(repo_path, str) or not repo_path:
          return ""
  
      repo_path = repo_path.strip().rstrip("/")
  
      if isinstance(repo_path, pathlib.Path):
          repo_path = str(repo_path)
      if repo_path == ".":
          return os.getcwd()
      if repo_path == "~":
          return os.path.expanduser("~")
  
      if repo_path.endswith(get_aim_repo_name()):
          repo_path = repo_path[: -len(get_aim_repo_name())]
      if repo_path.startswith("~"):
          repo_path = os.path.expanduser("~") + repo_path[1:]
  
      return os.path.abspath(repo_path)
  
imports: import os
  import shutil
  import tarfile
  import pathlib
  import re
  import uuid
  from contextlib import contextmanager
  from typing import Union, Any, Tuple, Optional, Callable
  from aim.sdk.configs import get_aim_repo_name
  from aim.storage.object import CustomObject
  from logging import getLogger
label_desc: Use image node_id 3 for calling a global function with example usage: clean_repo_path(repo_path) and returns: os, str, os, os