class_docstr: Base class for a Wrapper around an algorithm.
docstr: Unwrap until the given type of wrapper or algorithm is encountered.
  
  If it isn't, raises a RuntimeError.
docstr_tok: ["Unwrap","until","the","given","type","of","wrapper","or","algorithm","is","encountered",".","If","it","is","n't",",","raises","a","RuntimeError","."]
code: def unwrap(self, target_type: type[WrappedT]) -> WrappedT:
      """Unwrap until the given type of wrapper or algorithm is encountered.
  
      If it isn't, raises a RuntimeError.
      """
      node = self
      while isinstance(node, AlgoWrapper):
          if isinstance(node, target_type):
              return node
          node = node.algorithm
      if isinstance(node, target_type):
          return node
      raise RuntimeError(
          f"Unable to find a wrapper or algorithm of type {target_type} in {self}"
      )
  
imports: from __future__ import annotations
  import copy
  from logging import getLogger
  from typing import TYPE_CHECKING, Generic, Sequence, TypeVar
  from orion.algo.base import BaseAlgorithm
  from orion.algo.space import Space
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 7 for calling the AlgoWrapper obj's underlying member method code with example usage: obj.unwrap(target_type) and returns: node, node