code: def resolve(name):
      # simplified from zope.dottedname
      parts = name.split(".")
  
      used = parts.pop(0)
      found = __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 on python 3
          try:
              __import__(used)
          except ImportError as ex:
              # str is used for py2 vs py3
              expected = str(ex).split()[-1]
              if expected == used:
                  raise
              else:
                  raise ImportError(
                      "import error in %s: %s" % (used, ex)
                  )
          found = annotated_getattr(found, part, used)
      return found
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import re
  import sys
  import warnings
  from contextlib import contextmanager
  import six
  import pytest
  from _pytest.fixtures import fixture
  from _pytest.pathlib import Path
label_desc: Use image node_id 2 for calling a global function with example usage: resolve(name) and returns: found