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

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

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

    return (obj, '.'.join(names[i:]))


# this causes any exceptions occurring in trait handlers to be re-raised.
# Without this, the default behavior is for the exception to be logged and not
# re-raised.
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/container.py/proxy_parent