code: def _reformat_name(name: str) -> str:
      from gto.constants import SEPARATOR_IN_NAME, fullname_re
  
      # NOTE: DVC accepts names like
      #   path/to/dvc.yaml:artifact_name
      # but Studio/GTO tags are generated with
      #   path/to:artifact_name
      m = fullname_re.match(name)
      if m and m.group("dirname"):
          group = m.group("dirname").rstrip(SEPARATOR_IN_NAME)
          dirname, basename = posixpath.split(group)
          if basename == PROJECT_FILE:
              name = f"{dirname}{SEPARATOR_IN_NAME}{m.group('name')}"
      return name
  
imports: import os
  import posixpath
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
  from dvc.annotations import Artifact
  from dvc.dvcfile import PROJECT_FILE
  from dvc.exceptions import ArtifactNotFoundError, DvcException, FileExistsLocallyError, InvalidArgumentError
  from dvc.log import logger
  from dvc.utils import relpath, resolve_output
  from dvc.utils.objects import cached_property
  from dvc.utils.serialize import modify_yaml
label_desc: Use image node_id 4 for calling a global function with example usage: _reformat_name(name) and returns: name