code: def resolve(name: str) -> object:
      # Simplified from zope.dottedname.
      parts = name.split(".")
  
      used = parts.pop(0)
      found: object = __import__(used)
      for part in parts:
          used += "." + part
          try:
              found = getattr(found, part)
          except AttributeError:
              pass
          else:
              continue
          # We use explicit un-nesting of the handling block in order
          # to avoid nested exceptions.
          try:
              __import__(used)
          except ImportError as ex:
              expected = str(ex).split()[-1]
              if expected == used:
                  raise
              else:
                  raise ImportError(
                      f"import error in {used}: {ex}"
                  ) from ex
          found = annotated_getattr(found, part, used)
      return found
  
imports: import os
  import re
  import sys
  import warnings
  from contextlib import contextmanager
  from typing import Any
  from typing import Generator
  from typing import List
  from typing import Mapping
  from typing import MutableMapping
  from typing import Optional
  from typing import overload
  from typing import Tuple
  from typing import TypeVar
  from typing import Union
  from _pytest.compat import final
  from _pytest.fixtures import fixture
  from _pytest.warning_types import PytestWarning
label_desc: Use image node_id 2 for calling a global function with example usage: resolve(name) and returns: found