def _get_content(files_content, dep2files, file2deps, tails):

        content = ""
        while tails:
            tail = tails.pop(0)
            content += files_content[tail]

            files = dep2files.pop(tail, [])

            for file in files:
                deps = file2deps[file]
                deps.remove(tail)
                if not deps:
                    tails.append(file)
                    del file2deps[file]

        return content