'Return the specified Output value from the nested stack.
If the output key does not exist, raise an InvalidTemplateAttribute
exception. (Note that TemplateResource.get_attribute() relies on this
particular exception, not KeyError, being raised if the key does not
exist.)'

def get_output(self, op):

    if ((self._outputs is None) or ((op in self._outputs) and (rpc_api.OUTPUT_ERROR not in self._outputs[op]) and (self._outputs[op].get(rpc_api.OUTPUT_VALUE) is None))):
        stack_identity = self.nested_identifier()
        if (stack_identity is None):
            return
        stack = self.rpc_client().show_stack(self.context, dict(stack_identity))
        if (not stack):
            return
        outputs = (stack[0].get(rpc_api.STACK_OUTPUTS) or {})
        self._outputs = {o[rpc_api.OUTPUT_KEY]: o for o in outputs}
    if (op not in self._outputs):
        raise exception.InvalidTemplateAttribute(resource=self.name, key=op)
    output_data = self._outputs[op]
    if (rpc_api.OUTPUT_ERROR in output_data):
        raise exception.TemplateOutputError(resource=self.name, attribute=op, message=output_data[rpc_api.OUTPUT_ERROR])
    return output_data[rpc_api.OUTPUT_VALUE]
