def StatEntryFromStat(stat, pathspec, ext_attrs=True):
    'Build a stat entry object from a given stat object.\n\n  Args:\n    stat: A `Stat` object.\n    pathspec: A `PathSpec` from which `stat` was obtained.\n    ext_attrs: Whether to include extended file attributes in the result.\n\n  Returns:\n    `StatEntry` object.\n  '
    result = rdf_client_fs.StatEntry(pathspec=pathspec)
    for attr in _STAT_ATTRS:
        value = getattr(stat.GetRaw(), attr, None)
        if (value is None):
            continue
        value = int(value)
        if (value < 0):
            value &= 4294967295
        setattr(result, attr, value)
    result.st_flags_linux = stat.GetLinuxFlags()
    result.st_flags_osx = stat.GetOsxFlags()
    if ext_attrs:
        result.ext_attrs = list(GetExtAttrs(stat.GetPath()))
    return result
Build a stat entry object from a given stat object.

Args:
  stat: A `Stat` object.
  pathspec: A `PathSpec` from which `stat` was obtained.
  ext_attrs: Whether to include extended file attributes in the result.

Returns:
  `StatEntry` object.
def StatEntryFromStat(stat, pathspec, ext_attrs=True):
    'Build a stat entry object from a given stat object.\n\n  Args:\n    stat: A `Stat` object.\n    pathspec: A `PathSpec` from which `stat` was obtained.\n    ext_attrs: Whether to include extended file attributes in the result.\n\n  Returns:\n    `StatEntry` object.\n  '
    result = rdf_client_fs.StatEntry(pathspec=pathspec)
    for attr in _STAT_ATTRS:
        value = getattr(stat.GetRaw(), attr, None)
        if (value is None):
            continue
        value = int(value)
        if (value < 0):
            value &= 4294967295
        setattr(result, attr, value)
    result.st_flags_linux = stat.GetLinuxFlags()
    result.st_flags_osx = stat.GetOsxFlags()
    if ext_attrs:
        result.ext_attrs = list(GetExtAttrs(stat.GetPath()))
    return result