'Given a TSK info object make a StatEntry.
Note that tsk uses two things to uniquely identify a data stream - the inode
object given in tsk_file and the attribute object which may correspond to an
ADS of this file for filesystems which support ADS. We store both of these
in the stat response.
Args:
tsk_file: A TSK File object for the specified inode.
tsk_attribute: A TSK Attribute object for the ADS. If None we use the main
stream.
append_name: If specified we append this name to the last element of the
pathspec.
Returns:
A StatEntry which can be used to re-open this exact VFS node.'

def MakeStatResponse(self, tsk_file, tsk_attribute=None, append_name=False):

    info = tsk_file.info
    response = rdf_client.StatEntry()
    meta = info.meta
    if meta:
        response.st_ino = meta.addr
        for attribute in ['mode', 'nlink', 'uid', 'gid', 'size', 'atime', 'mtime', 'ctime', 'crtime']:
            try:
                value = int(getattr(meta, attribute))
                if (value < 0):
                    value &= 4294967295
                setattr(response, ('st_%s' % attribute), value)
            except AttributeError:
                pass
    name = info.name
    child_pathspec = self.pathspec.Copy()
    if append_name:
        child_pathspec.last.path = utils.JoinPath(child_pathspec.last.path, utils.SmartUnicode(append_name))
    child_pathspec.last.inode = meta.addr
    if (tsk_attribute is not None):
        child_pathspec.last.ntfs_type = int(tsk_attribute.info.type)
        child_pathspec.last.ntfs_id = int(tsk_attribute.info.id)
        child_pathspec.last.stream_name = tsk_attribute.info.name
        response.st_size = tsk_attribute.info.size
        default = rdf_paths.PathSpec.tsk_fs_attr_type.TSK_FS_ATTR_TYPE_DEFAULT
        last = child_pathspec.last
        if ((last.ntfs_type != default) or last.ntfs_id):
            response.st_mode &= (~ self.stat_type_mask)
            response.st_mode |= stat.S_IFREG
    else:
        child_pathspec.last.ntfs_type = None
        child_pathspec.last.ntfs_id = None
        child_pathspec.last.stream_name = None
    if name:
        response.st_mode |= self.FILE_TYPE_LOOKUP.get(int(name.type), 0)
    if meta:
        response.st_mode |= self.META_TYPE_LOOKUP.get(int(meta.type), 0)
    response.pathspec = child_pathspec
    return response
