from pathlib import Path


def _convert_dirs_to_paths(d):
    """Recursively convert all dirs to Paths"""
    for key, val in d.items():
        if isinstance(val, dict):
            d[key] = _convert_dirs_to_paths(val)
        elif key.endswith('_dir') or key.endswith('_folder') or key.endswith('_file'):
            d[key] = Path(val)
    return d