code: def _get_option(target_obj, key):
      """
      Given a target object and option key, get that option from
      the target object, either through a get_{key} method or
      from an attribute directly.
      """
      getter_name = "get_{key}".format(**locals())
      by_attribute = functools.partial(getattr, target_obj, key)
      getter = getattr(target_obj, getter_name, by_attribute)
      return getter()
  
imports: from __future__ import absolute_import, unicode_literals
  import io
  import os
  import sys
  import warnings
  import functools
  from collections import defaultdict
  from functools import partial
  from functools import wraps
  from importlib import import_module
  from distutils.errors import DistutilsOptionError, DistutilsFileError
  from setuptools.extern.packaging.version import LegacyVersion, parse
  from setuptools.extern.packaging.specifiers import SpecifierSet
  from setuptools.extern.six import string_types, PY3
label_desc: Use image node_id 2 for calling a global function with example usage: _get_option(target_obj, key) and returns: getter