import textwrap


def BASE64_to_PEM(cert: str) -> str:
    """Convert a raw BASE64 encoded certificate to PEM format (wrapped by 64 characters)"""
    return '-----BEGIN CERTIFICATE-----' + '\n' + "\n".join(textwrap.wrap(cert, width=64)) + '\n' + '-----END CERTIFICATE-----'