def list_to_tree(cls, files):
        """Converts a list of filenames into a directory tree structure."""

        def attach(branch, trunk):
            """Insert a branch of directories on its trunk."""
            parts = branch.split('/', 1)
            if len(parts) == 1:  # branch is a file
                trunk[FILE_MARKER].append(parts[0])
            else:
                node, others = parts
                if node not in trunk:
                    trunk[node] = defaultdict(dict, ((FILE_MARKER, []), ))
                attach(others, trunk[node])

        tree = defaultdict(dict, ((FILE_MARKER, []), ))
        for line in files:
            attach(line, tree)
        return tree
Converts a list of filenames into a directory tree structure.