code: def _check_wrapped(cls: Type, rewrap: str) -> bool:
      wrapped = None
      if is_model_wrapped(cls):
          wrapped = "model_wrapper"
      elif is_basic_unit(cls):
          wrapped = "basic_unit"
      elif is_wrapped_with_trace(cls):
          wrapped = "nni.trace"
      if wrapped:
          if wrapped != rewrap:
              raise TypeError(
                  f"{cls} is already wrapped with {wrapped}. Cannot rewrap with {rewrap}."
              )
          return True
      return False
  
file_path: nni/nni/nas/utils/_legacy.py
imports: import inspect
  import os
  import warnings
  from typing import Any, TypeVar, Type
  from nni.common.serializer import is_traceable, is_wrapped_with_trace, trace
label_desc: Use image node_id 7 for calling a global function with example usage: _check_wrapped(cls, rewrap) and returns: False, True