Let's practice with another option for data aggregation on file systems. We'll write a function that accepts a directory as input and returns a list of directories of the first level of nesting and the number of files inside each of them, including all subdirectories:
from hexlet import fs
tree = fs.mkdir('/', [
fs.mkdir('etc', [
fs.mkdir('apache'),
fs.mkdir('nginx', [
fs.mkfile('nginx.conf'),
]),
]),
fs.mkdir('consul', [
fs.mkfile('config.json'),
fs.mkfile('file.tmp'),
fs.mkdir('data'),
]),
fs.mkfile('hosts'),
fs.mkfile('resolve'),