import re


def is_base64(text: str) -> bool:
    """Guess whether text is base64-encoded."""
    return bool(
        re.match(
            r"^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$",
            text.replace("\n", ""),
        )
    )