def get_closest_proxy(obj, pathname):
    """Returns a tuple of the form (val, restofpath), where val
    is either the object specified by dotted name 'pathname'
    within obj, or the closest in-process proxy object that can be
    resolved.  If val is a proxy, restofpath will contain the
    remaining part of pathname needed to resolve the desired attribute
    within the proxy.  Otherwise, val is the actual desired attribute
    and restofpath is the empty string.
    """
    names = pathname.split('.')

    i = 0
    for name in names:
        if IContainerProxy.providedBy(obj):
            return (obj, '.'.join(names[i:]))

        try:
            obj = getattr(obj, name)
        except __HOLE__:
            break
        i += 1

    return (obj, '.'.join(names[i:]))
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/container.py/get_closest_proxy