def _build_target(action, original_target, plugin, context):
 target = original_target.copy()
 (resource, _a) = get_resource_and_action(action)
 hierarchy_info = attributes.RESOURCE_HIERARCHY_MAP.get(resource, None)
 if (hierarchy_info and plugin):
  parent_resource = hierarchy_info['parent'][:(-1)]
  parent_id = hierarchy_info['identified_by']
  f = getattr(plugin, ('get_%s' % parent_resource))
  data = f(context, target[parent_id], fields=['tenant_id'])
  target[('%s_tenant_id' % parent_resource)] = data['tenant_id']
 return target

def _build_target ( action , original_target , plugin , context ) : target = original_target . copy ( ) ( resource , _a ) = get_resource_and_action ( action ) hierarchy_info = attributes . RESOURCE_HIERARCHY_MAP . get ( resource , None ) if ( hierarchy_info and plugin ) : parent_resource = hierarchy_info [ 'parent' ] [ : ( - 1 ) ] parent_id = hierarchy_info [ 'identified_by' ] f = getattr ( plugin , ( 'get_%s' % parent_resource ) ) data = f ( context , target [ parent_id ] , fields = [ 'tenant_id' ] ) target [ ( '%s_tenant_id' % parent_resource ) ] = data [ 'tenant_id' ] return target
augment dictionary of target attributes for policy engine .