class_docstr: Class that manages experiments in a DVC repo.
  
  Args:
      repo (dvc.repo.Repo): repo instance that these experiments belong to.
class_docstr_tok: ["Class","that","manages","experiments","in","a","DVC","repo",".","Args",":","repo","(","dvc.repo.Repo",")",":","repo","instance","that","these","experiments","belong","to","."]
docstr: Returns full refname for the experiment branch containing rev.
docstr_tok: ["Returns","full","refname","for","the","experiment","branch","containing","rev","."]
code: def get_branch_by_rev(
      self, rev: str, allow_multiple: bool = False
  ) -> Optional[str]:
      """Returns full refname for the experiment branch containing rev."""
      ref_infos = list(exp_refs_by_rev(self.scm, rev))
      if not ref_infos:
          return None
      if len(ref_infos) > 1 and not allow_multiple:
          for ref_info in ref_infos:
              if self.scm.get_ref(str(ref_info)) == rev:
                  return str(ref_info)
          raise MultipleBranchError(rev, ref_infos)
      return str(ref_infos[0])
  
imports: import os
  import re
  from typing import TYPE_CHECKING, Dict, Iterable, List, Optional
  from funcy import chain, first
  from dvc.log import logger
  from dvc.ui import ui
  from dvc.utils import relpath
  from dvc.utils.objects import cached_property
  from .cache import ExpCache
  from .exceptions import BaselineMismatchError, ExperimentExistsError, InvalidExpRefError, MultipleBranchError
  from .refs import APPLY_STASH, CELERY_FAILED_STASH, CELERY_STASH, EXEC_APPLY, EXEC_NAMESPACE, EXPS_NAMESPACE, WORKSPACE_STASH, ExpRefInfo
  from .stash import ApplyStash
  from .utils import check_ref_format, exp_refs_by_rev, unlocked_repo
label_desc: Use image node_id 21 for calling the Experiments obj's underlying member method code with example usage: obj.get_branch_by_rev(rev, allow_multiple) and returns: str, None, str