def METHOD_NAME(tmpdir):
    def assertDirIsUniqueAndNamed(dirs, name):
        assert len(dirs) == 1
        assert dirs[0].is_dir()
        assert dirs[0].name == name
    end_dir = os.path.join(tmpdir, "dir_in_the_middle", "leaf_dir")
    utils.mkdir(end_dir)
    middle_dirs = list(os.scandir(tmpdir))
    assertDirIsUniqueAndNamed(middle_dirs, "dir_in_the_middle")
    leaf_dirs = list(os.scandir(middle_dirs[0].path))
    assertDirIsUniqueAndNamed(leaf_dirs, "leaf_dir")