docstr: Return revision containing the given artifact.
docstr_tok: ["Return","revision","containing","the","given","artifact","."]
code: def get_rev(
      self,
      name: str,
      version: Optional[str] = None,
      stage: Optional[str] = None,
  ):
      """Return revision containing the given artifact."""
      from gto.base import sort_versions
      from gto.tag import find, parse_tag
  
      assert not (version and stage)
      name = _reformat_name(name)
      tags: List["GitTag"] = find(
          name=name, version=version, stage=stage, scm=self.scm
      )
      if not tags:
          raise ArtifactNotFoundError(
              name, version=version, stage=stage
          )
      if version or stage:
          return tags[-1].target
      gto_tags: List["GTOTag"] = sort_versions(
          parse_tag(tag) for tag in tags
      )
      return gto_tags[0].tag.target
  
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 5 for calling the Artifacts obj's underlying member method code with example usage: obj.get_rev(name, version, stage) and returns: gto_tags, tags