def _get_option(target_obj: Target, key: str):
    """
    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 = f'get_{key}'
    by_attribute = functools.partial(getattr, target_obj, key)
    getter = getattr(target_obj, getter_name, by_attribute)
    return getter()

    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.
    
product/gradle-plugin/src/main/python/setuptools/config/setupcfg.py