def _clean_extensions(extensions):
    """Remove whitespace and prepend a period to extensions."""
    result = []
    for extension in extensions:
        if not isinstance(extension, str):
            continue
        cleaned = extension.strip().lower()
        if cleaned.startswith('.'):
            result.append(cleaned)
        else:
            result.append('.' + cleaned)
    return result