def METHOD_NAME(localroot, root, tree, maxdepth=100):
    if maxdepth == 0:
        return
    localpath = os.path.join(localroot, root[1:])
    logit(" %s\n" % (localpath))
    if not os.access(localpath, os.R_OK):
        logit(" Cannot access %s\n" % localpath)
        return
    for name in os.listdir(localpath):
        fspath = os.path.join(root, name)
        if checkblacklist(fspath):
            continue
        path = os.path.join(localpath, name)
        try:
            if os.path.islink(path):
                s = os.lstat(path)
            else:
                s = os.stat(path)
        except OSError:
            continue
        entry = [
            name,
            T_FILE,
            s.st_uid,
            s.st_gid,
            s.st_size,
            s.st_mode,
            int(s.st_mtime),
            [],
            None,
            None,
        ]
        if S_ISLNK(s[ST_MODE]):
            if not os.access(path, os.R_OK):
                logit(" Cannot access link: %s\n" % path)
                continue
            realpath = os.path.realpath(path)
            if not realpath.startswith(localroot):
                logit(
                    ' Link "{}" has real path "{}" outside local root "{}"\n'.format(
                        path, realpath, localroot
                    )
                )
                continue
            else:
                entry[A_TYPE] = T_LINK
                entry[A_TARGET] = realpath[len(localroot) :]
        elif S_ISDIR(s[ST_MODE]):
            entry[A_TYPE] = T_DIR
            if (PROC or not localpath.startswith("/proc/")) and maxdepth > 0:
                METHOD_NAME(localroot, fspath, entry[A_CONTENTS], maxdepth - 1)
        elif S_ISREG(s[ST_MODE]):
            entry[A_TYPE] = T_FILE
        elif S_ISBLK(s[ST_MODE]):
            entry[A_TYPE] = T_BLK
        elif S_ISCHR(s[ST_MODE]):
            entry[A_TYPE] = T_CHR
        elif S_ISSOCK(s[ST_MODE]):
            entry[A_TYPE] = T_SOCK
        elif S_ISFIFO(s[ST_MODE]):
            entry[A_TYPE] = T_FIFO
        else:
            sys.stderr.write("We should handle %s" % path)
            sys.exit(1)
        tree.append(entry)