'Get immediate parent of given type via \'parent\' property.
:param child: Child entity reference
:param parent_type: Entity type of the parent
:return: Immediate parent of specific type up the hierarchy via
\'parent\' property'

def _get_parent(self, child, parent_type):

    if (not child):
        return None
    if (child._type == parent_type):
        return child
    parent = self._session.invoke_api(vim_util, 'get_object_property', self._session.vim, child, 'parent')
    return self._get_parent(parent, parent_type)
