'Return a NodeData object representing the resource.
The NodeData object returned contains basic data about the resource,
including its name, ID and state, as well as its reference ID and any
attribute values that are used.
By default, those attribute values that are referenced by other
resources are included. These can be ignored by setting the
for_resources parameter to False. If the for_outputs parameter is
True, those attribute values that are referenced by stack outputs are
included. If the for_outputs parameter is an iterable of output names,
only those attribute values referenced by the specified stack outputs
are included.
The set of referenced attributes is calculated from the
StackDefinition object provided, or from the stack\'s current
definition if none is passed.
After calling this method, the resource\'s attribute cache is
populated with any cacheable attribute values referenced by stack
outputs, even if they are not also referenced by other resources.'

def node_data(self, stk_defn=None, for_resources=True, for_outputs=False):

    def get_attrs(attrs, cacheable_only=False):
        for attr in attrs:
            path = ((attr,) if isinstance(attr, six.string_types) else attr)
            if (cacheable_only and (self.attributes.get_cache_mode(path[0]) == attributes.Schema.CACHE_NONE)):
                continue
            if (self.action == self.INIT):
                if ((path[0] in self.attributes) or ((type(self).get_attribute != Resource.get_attribute) or (type(self).FnGetAtt != Resource.FnGetAtt))):
                    (yield (attr, None))
            else:
                try:
                    (yield (attr, self.FnGetAtt(*path)))
                except exception.InvalidTemplateAttribute as ita:
                    LOG.info('%s', ita)
    load_all = (not self.stack.in_convergence_check)
    dep_attrs = self.referenced_attrs(stk_defn, in_resources=for_resources, in_outputs=for_outputs, load_all=load_all)
    if ((for_outputs is False) and self.stack.convergence):
        out_attrs = self.referenced_attrs(stk_defn, in_resources=False, load_all=load_all)
        for e in get_attrs((out_attrs - dep_attrs), cacheable_only=True):
            pass
    return node_data.NodeData(self.id, self.name, self.uuid, self.FnGetRefId(), dict(get_attrs(dep_attrs)), self.action, self.status)
