from pathlib import Path


def _resolve_cache_folder(cache_path: str):
    """Expand and optionally creates cache folder."""
    cache_folder = Path(cache_path).expanduser()
    if not cache_folder.is_dir():
        cache_folder.mkdir(parents=True, exist_ok=True)
    return str(cache_folder)