code: def annotated_getattr(obj, name, ann):
      try:
          obj = getattr(obj, name)
      except AttributeError:
          raise AttributeError(
              "%r object at %s has no attribute %r"
              % (type(obj).__name__, ann, name)
          )
      return obj
  
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 3 for calling a global function with example usage: annotated_getattr(obj, name, ann) and returns: obj