from typing import Dict


def is_valid_config(
    config: Dict,
) -> bool:
    """Validate configuration."""
    docs = config.get('docs', None)
    if not docs:
        print("Missing top-level 'docs' key")
        return False
    repo = docs.get('repo', None)
    if not repo:
        print("Missing 'repo' under 'docs'")
        return False
    versions = docs.get('versions', None)
    if not versions:
        print("Missing 'versions' under 'docs'")
        return False
    for version_name, packages in versions.items():
        if not isinstance(version_name, str):
            print('Versions have to be strings. Invalid version(s):', version_name)
            return False
        if packages:
            # Convert string to list if necessary
            packages = [packages] if not isinstance(packages, list) else packages
            versions[version_name] = packages
            if any(not isinstance(package, str) for package in packages):
                print('Packages have to be strings. Invalid package(s):', packages)
                return False
    return True